调试app支付回调
This commit is contained in:
parent
7b448db370
commit
8ac105a4aa
@ -5,27 +5,21 @@ namespace app\adminapi\controller;
|
|||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
use app\common\model\user\Task;
|
use app\common\model\user\Task;
|
||||||
|
|
||||||
|
|
||||||
class TaskController extends BaseAdminController
|
class TaskController extends BaseAdminController
|
||||||
{
|
{
|
||||||
private $url;
|
|
||||||
|
|
||||||
//获取任务列表
|
public function index()
|
||||||
public function list()
|
|
||||||
{
|
{
|
||||||
$param = get_params();
|
$param = get_params();
|
||||||
$param['uid'] = $this->adminId;
|
$param['uid'] = $this->adminId;
|
||||||
$param['page'] = $param['page'] ?? 1;
|
[$param['page'], $param['limit']] = $this->getPage();
|
||||||
$param['limit'] = $param['limit'] ?? 10;
|
[$count, $list] = (new Task())->list($param);
|
||||||
$list = (new Task())->list($param);
|
return $this->success('success', ['count' => $count, 'list' => $list]);
|
||||||
return to_assign(200, 'success', $list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//新建任务
|
public function create()
|
||||||
public function add()
|
|
||||||
{
|
{
|
||||||
$param = get_params();
|
$param = get_params();
|
||||||
|
|
||||||
//markdown数据处理
|
//markdown数据处理
|
||||||
if (isset($param['table-align'])) {
|
if (isset($param['table-align'])) {
|
||||||
unset($param['table-align']);
|
unset($param['table-align']);
|
||||||
@ -57,14 +51,13 @@ class TaskController extends BaseAdminController
|
|||||||
$check_time2 = $date + 32400;//早上9点
|
$check_time2 = $date + 32400;//早上9点
|
||||||
} else {
|
} else {
|
||||||
$check_time2 = ($date + 32400) + (3600 * $times[0]);//准确时间
|
$check_time2 = ($date + 32400) + (3600 * $times[0]);//准确时间
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$check_time2 = ($date + 32400) + (3600 * $c);//准确时间
|
$check_time2 = ($date + 32400) + (3600 * $c);//准确时间
|
||||||
}
|
}
|
||||||
$times3 = Strtotime(date('Y-m-t', time())) + 64800;
|
$times3 = Strtotime(date('Y-m-t', time())) + 64800;
|
||||||
if ($check_time2 > $times3) {
|
if ($check_time2 > $times3) {
|
||||||
to_assign(1, '验收时间不能大于本月月底18点 跨月时间:' . date('Y-m-d H:i:s', $check_time2));
|
return $this->fail('验收时间不能大于本月月底18点 跨月时间:' . date('Y-m-d H:i:s', $check_time2));
|
||||||
}
|
}
|
||||||
$param['check_time'] = $check_time2;
|
$param['check_time'] = $check_time2;
|
||||||
$param['end_time'] = $param['end_time'] + 86399;
|
$param['end_time'] = $param['end_time'] + 86399;
|
||||||
@ -87,7 +80,7 @@ class TaskController extends BaseAdminController
|
|||||||
}
|
}
|
||||||
unset($param['name'], $param['real_val']);
|
unset($param['name'], $param['real_val']);
|
||||||
}
|
}
|
||||||
return to_assign(200, '发布成功', 1, 1);
|
return $this->success('发布成功', [], 1, 1);
|
||||||
} else {
|
} else {
|
||||||
$param['create_time'] = time();
|
$param['create_time'] = time();
|
||||||
$param['admin_id'] = $this->adminId;
|
$param['admin_id'] = $this->adminId;
|
||||||
@ -104,17 +97,16 @@ class TaskController extends BaseAdminController
|
|||||||
}
|
}
|
||||||
$param['initial_end_time'] = $param['end_time'];
|
$param['initial_end_time'] = $param['end_time'];
|
||||||
$sid = Task::strict(false)->field(true)->insertGetId($param);
|
$sid = Task::strict(false)->field(true)->insertGetId($param);
|
||||||
return to_assign(200, '发布成功', 1, 1);
|
return $this->success('发布成功', [], 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 任务详情
|
public function view($id)
|
||||||
public function read($id)
|
|
||||||
{
|
{
|
||||||
$detail = (new Task())->detail($id);
|
$detail = (new Task())->detail($id);
|
||||||
if (empty($detail)) {
|
if (empty($detail)) {
|
||||||
return to_assign(1, '任务不存在');
|
return $this->fail('任务不存在');
|
||||||
} else {
|
}
|
||||||
$role_uid = [$detail['admin_id'], $detail['director_uid']];
|
$role_uid = [$detail['admin_id'], $detail['director_uid']];
|
||||||
$role_edit = 'view';
|
$role_edit = 'view';
|
||||||
if (in_array($this->adminId, $role_uid)) {
|
if (in_array($this->adminId, $role_uid)) {
|
||||||
@ -149,11 +141,9 @@ class TaskController extends BaseAdminController
|
|||||||
$return['file_array'] = $file_array;
|
$return['file_array'] = $file_array;
|
||||||
$return['link_array'] = $link_array;
|
$return['link_array'] = $link_array;
|
||||||
$return['role_edit'] = $role_edit;
|
$return['role_edit'] = $role_edit;
|
||||||
$return['url'] = $this->url;
|
|
||||||
$approve_id = Db::name('flow_task')->where('task_id', $id)->value('approve_id');
|
$approve_id = Db::name('flow_task')->where('task_id', $id)->value('approve_id');
|
||||||
$return['flow_nodes'] = $this->get_flow_nodes($approve_id);
|
$return['flow_nodes'] = $this->get_flow_nodes($approve_id);
|
||||||
return to_assign(200, '获取成功', $return);
|
return $this->success('success', $return);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取审核流程节点
|
//获取审核流程节点
|
||||||
@ -214,9 +204,9 @@ class TaskController extends BaseAdminController
|
|||||||
);
|
);
|
||||||
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
Db::name('Log')->strict(false)->field(true)->insert($log_data);
|
||||||
}
|
}
|
||||||
return to_assign(200, '驳回成功', 1, 1);
|
return $this->success('驳回成功', [], 1, 1);
|
||||||
} else {
|
} else {
|
||||||
return to_assign(200, '驳回失败', 1, 1);
|
return $this->fail('驳回失败');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,4 +120,19 @@ class PayController extends BaseApiController
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes app支付回调
|
||||||
|
* @return \Psr\Http\Message\ResponseInterface
|
||||||
|
* @throws \EasyWeChat\Kernel\Exceptions\InvalidArgumentException
|
||||||
|
* @throws \EasyWeChat\Kernel\Exceptions\RuntimeException
|
||||||
|
* @throws \ReflectionException
|
||||||
|
* @throws \Throwable
|
||||||
|
* @date 2023/2/28 14:21
|
||||||
|
*/
|
||||||
|
public function notifyApp()
|
||||||
|
{
|
||||||
|
return (new WeChatPayService(UserTerminalEnum::ANDROID))->notify();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ use app\common\model\user\UserAuth;
|
|||||||
use app\common\service\wechat\WeChatConfigService;
|
use app\common\service\wechat\WeChatConfigService;
|
||||||
use EasyWeChat\Pay\Application;
|
use EasyWeChat\Pay\Application;
|
||||||
use EasyWeChat\Pay\Message;
|
use EasyWeChat\Pay\Message;
|
||||||
|
use think\facade\Log;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -366,6 +367,7 @@ class WeChatPayService extends BasePayService
|
|||||||
$server = $this->app->getServer();
|
$server = $this->app->getServer();
|
||||||
// 支付通知
|
// 支付通知
|
||||||
$server->handlePaid(function (Message $message) {
|
$server->handlePaid(function (Message $message) {
|
||||||
|
Log::info('wechat pay notify', $message->toArray());
|
||||||
if ($message['trade_state'] === 'SUCCESS') {
|
if ($message['trade_state'] === 'SUCCESS') {
|
||||||
$extra['transaction_id'] = $message['transaction_id'];
|
$extra['transaction_id'] = $message['transaction_id'];
|
||||||
$attach = $message['attach'];
|
$attach = $message['attach'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user