Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
ic_server_welfare
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
05d42acf
authored
Sep 10, 2019
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加通知
parent
238877ed
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
44 additions
and
2 deletions
.env
app/Http/Controllers/AssistsController.php
app/Http/Controllers/CodesController.php
app/Models/Assist.php
app/Models/Code.php
config/system.php
storage/laravels.json
storage/laravels.pid
.env
View file @
05d42acf
...
...
@@ -42,6 +42,8 @@ REDIS_READ_HOST=192.168.1.235
REDIS_READ_PASSWORD=icDb29mLy2s
REDIS_READ_PORT=6379
IC_AUTH_API=http://authapi.icsales.cc
RobotUrl=https://oapi.dingtalk.com/robot/send?access_token=a7255513c160f20d65c0c00d939fe88712233bbda0dc520563705bf721072d11
app/Http/Controllers/AssistsController.php
View file @
05d42acf
...
...
@@ -68,6 +68,8 @@ class AssistsController extends Controller
if
(
$canAssist
)
{
$result
=
$assist
->
addAssist
(
$data
);
if
(
$result
)
{
//好友助力成功一次就要向用户添加一条站内信
$assist
->
sendNotice
(
$data
[
'user_id'
]);
return
$this
->
Export
(
0
,
'ok'
);
}
else
{
return
$this
->
Export
(
ErrorCode
(
20
,
5
),
'新增好友助力记录失败'
);
...
...
app/Http/Controllers/CodesController.php
View file @
05d42acf
...
...
@@ -8,6 +8,8 @@ use App\Http\Filters\CodeFilter;
use
App\Models\CheckIn
;
use
App\Models\Code
;
use
App\Models\Integral
;
use
App\Tasks\SendNoticeTask
;
use
Hhxsv5\LaravelS\Swoole\Task\Task
;
use
Illuminate\Http\Request
;
//红包码兑换管理
...
...
@@ -55,6 +57,8 @@ class CodesController extends Controller
if
(
$canAddCode
)
{
$res
=
$code
->
addCode
(
$data
);
if
(
$res
)
{
//向被兑换红包码所属用户发送通知
$code
->
sendNotice
(
$data
[
'code'
]);
return
$this
->
Export
(
0
,
'ok'
);
}
else
{
return
$this
->
Export
(
ErrorCode
(
21
,
5
),
'红包码兑换失败'
);
...
...
app/Models/Assist.php
View file @
05d42acf
...
...
@@ -6,6 +6,7 @@ namespace App\Models;
use
App\Http\Filters\QueryFilter
;
use
App\Tasks\IntegralBillTask
;
use
App\Tasks\SendNoticeTask
;
use
Common\Model\RedisModel
;
use
Carbon\Carbon
;
use
Hhxsv5\LaravelS\Swoole\Task\Task
;
...
...
@@ -120,4 +121,16 @@ class Assist extends Model
//不存在记录的话就代表可以直接插入
return
true
;
}
//添加通知
public
function
sendNotice
(
$userId
)
{
$redis
=
new
RedisModel
();
$user
=
$redis
->
hget
(
'ic_user'
,
$userId
);
if
(
$user
)
{
//发送通知
$task
=
new
SendNoticeTask
(
'IC_Code_Exchange'
,
$user
,
$userId
);
Task
::
deliver
(
$task
);
}
}
}
\ No newline at end of file
app/Models/Code.php
View file @
05d42acf
...
...
@@ -5,7 +5,9 @@ namespace App\Models;
use
App\Http\Filters\QueryFilter
;
use
App\Tasks\SendNoticeTask
;
use
Common\Model\RedisModel
;
use
Hhxsv5\LaravelS\Swoole\Task\Task
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\Log
;
...
...
@@ -130,4 +132,19 @@ class Code extends Model
return
$result
;
}
//发送通知
public
function
sendNotice
(
$code
)
{
//找出红包码所属的userId
$codeUserId
=
substr
(
$code
,
2
);
//找到用户信息
$redis
=
new
RedisModel
();
$user
=
$redis
->
hget
(
'ic_user'
,
$codeUserId
);
if
(
$user
)
{
//发送通知
$task
=
new
SendNoticeTask
(
'IC_Code_Exchange'
,
$user
,
$codeUserId
);
Task
::
deliver
(
$task
);
}
}
}
\ No newline at end of file
config/system.php
View file @
05d42acf
...
...
@@ -5,4 +5,5 @@ return [
'RobotUrl'
=>
'https://oapi.dingtalk.com/robot/send?access_token=245f39f3b18bfcb8d739068327a32327f5c0c868529b5d5ba357f919567ef1fd'
,
'SystemName'
=>
env
(
'SYSTEM_NAME'
,
'这家伙没设置系统'
),
//系统名称
"at"
=>
env
(
'AT'
),
'IC_AUTH_API'
=>
env
(
'IC_AUTH_API'
),
];
\ No newline at end of file
storage/laravels.json
View file @
05d42acf
This diff is collapsed.
Click to expand it.
storage/laravels.pid
View file @
05d42acf
19158
\ No newline at end of file
19880
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment