|
@@ -23,6 +23,8 @@ use crmeb\services\app\WechatService as WechatAuthService;
|
|
|
use crmeb\services\oauth\OAuth;
|
|
use crmeb\services\oauth\OAuth;
|
|
|
use crmeb\services\pay\Pay;
|
|
use crmeb\services\pay\Pay;
|
|
|
use crmeb\utils\Canvas;
|
|
use crmeb\utils\Canvas;
|
|
|
|
|
+use think\facade\Db;
|
|
|
|
|
+use think\facade\Log;
|
|
|
/**
|
|
/**
|
|
|
*
|
|
*
|
|
|
* Class WechatServices
|
|
* Class WechatServices
|
|
@@ -140,6 +142,8 @@ class WechatServices extends BaseServices
|
|
|
}
|
|
}
|
|
|
$user = $wechatUserServices->wechatOauthAfter($createData);
|
|
$user = $wechatUserServices->wechatOauthAfter($createData);
|
|
|
$wechatUserServices->wechatUpdata([$user['uid'], $wechatInfo]);
|
|
$wechatUserServices->wechatUpdata([$user['uid'], $wechatInfo]);
|
|
|
|
|
+ $unionid = $wechatInfo['unionid'];
|
|
|
|
|
+ $this->readUserScore($user['uid'],$unionid);
|
|
|
$token = $this->createToken((int)$user['uid'], 'api');
|
|
$token = $this->createToken((int)$user['uid'], 'api');
|
|
|
if ($token) {
|
|
if ($token) {
|
|
|
app()->make(UserVisitServices::class)->loginSaveVisit($user);
|
|
app()->make(UserVisitServices::class)->loginSaveVisit($user);
|
|
@@ -154,6 +158,36 @@ class WechatServices extends BaseServices
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private function readUserScore($uid,$unionid){
|
|
|
|
|
+ $params = [$unionid];
|
|
|
|
|
+ $list = Db::query('select * from eb_score_record where uniond_id = ? and `status` = 0', $params);
|
|
|
|
|
+ if(!empty($list)){
|
|
|
|
|
+ foreach ($list as $record) {
|
|
|
|
|
+ // Extract the parameters for the doAddScore function from the current record
|
|
|
|
|
+ $score = $record['score'];
|
|
|
|
|
+ $integration_status = $record['integration_status'];
|
|
|
|
|
+ $title = $record['title'];
|
|
|
|
|
+ $mark = $record['mark'];
|
|
|
|
|
+ $order_id = $record['order_id'];
|
|
|
|
|
+ $params = [$order_id];
|
|
|
|
|
+ $affectedRows =Db::execute('update `eb_score_record` set `status` = 1,send_time = now() where `order_id` = ?', $params);
|
|
|
|
|
+ if($affectedRows>0){
|
|
|
|
|
+ $result = $this->doAddScore($uid, $score, $integration_status, $title, $mark);
|
|
|
|
|
+ }
|
|
|
|
|
+ Log::info($result.'Score record processed:'.$record);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private function doAddScore($uid,$score,$integration_status,$title,$mark){
|
|
|
|
|
+ $userService = app()->make(UserServices::class);
|
|
|
|
|
+ $data = array('integration' => $score,'integration_status'=>$integration_status);
|
|
|
|
|
+ $data['title'] = $title;
|
|
|
|
|
+ $data['mark'] = $mark;
|
|
|
|
|
+ $data['is_other'] = true;
|
|
|
|
|
+ $result = $userService->addScore($uid,$data);
|
|
|
|
|
+ return $result;
|
|
|
|
|
+ }
|
|
|
/**
|
|
/**
|
|
|
* 公众号强制绑定手机号
|
|
* 公众号强制绑定手机号
|
|
|
* @param $key
|
|
* @param $key
|