作者 景龙
1 个管道 的构建 失败 耗费 0 秒

新增充值记录

... ... @@ -52,7 +52,7 @@ class Messages extends Api
if (!$validate->check(['page'=>$page])) {
$this->error($validate->getError());
}
$data = Db::table('gc_message_log')
$data = Db::table('gc_message')
->alias('l')
->join('gc_message m','l.message_id = m.id','LEFT')
->where(['l.user_id'=>$this->user_id])
... ...
... ... @@ -8,6 +8,8 @@ use app\admin\model\Porder;
use think\Db;
use Yansongda\Pay\Pay;
use app\admin\model\Account;
use app\admin\model\User;
use app\admin\model\Message;
use think\Log;
use fast\Http;
use think\Validate;
... ... @@ -195,9 +197,13 @@ class Wxpay extends Api
//你可以在这里你的业务处理逻辑,比如处理你的订单状态、给会员加余额等等功能
$data = $pay->verify();
if($data['return_code'] == 'SUCCESS' && $data['result_code'] == 'SUCCESS') {
$userModel = new User();
$user = $userModel->where(['openid'=>$data['openid']])->find();
$accountModel = new Account();
Log::info($data);
Log::info('充值回调');
$money = $data['total_fee']/100;
$account = $accountModel::create(['uid'=>$user['id'],'type'=>config('site.pay_charge'),'money'=>$money]);
$messageModel = new Message();
$messageModel::create(['aid'=>$account->id,'title'=>config('site.message')]);
//下面这句必须要执行,且在此之前不能有任何输出
echo $pay->success();
}
... ...
... ... @@ -53,7 +53,10 @@ return array (
'page_limit' => 10,
//消息已读
'is_read' => 1,
//充值
'pay_charge' => 1,
//系统消息提示
'message'=>'您有一个系统消息提示,请及时查看。',
//设置积分规则(分享购买,分享卖废品)
'share_purchase' => 150,
'share_sell' => 50,
... ...