作者 chencheng

0531-1

... ... @@ -211,7 +211,7 @@ class Wechat extends Api
/**注册 分销关系 如 https://coupon.cc/index.php/api/v1/wechat/register_relation?store_id=1&activity_id=3&share_id=2
/**注册 分销关系 如 http://coupon.cc/index.php/api/v1/wechat/register_relation?store_id=19&activity_id=3&share_id=3
* store_id,activity_id
* 关系 user表 id 和 pid
*/
... ... @@ -222,7 +222,7 @@ class Wechat extends Api
return $this->error('请求错误');
}
$my_user_id = $this->auth->id;
$my_user_id = 2;
if(empty($my_user_id)){return $this->error('用户信息错误');}
if(empty($param['store_id'])){return $this->error('门店信息错误');}
//记录门店浏览统计
... ... @@ -235,14 +235,15 @@ class Wechat extends Api
$myInfo = Db::name('user')->where($w)->find();
if(empty($myInfo['pid'])){
//更新分销关系
//本身是自己门店的代理角色,则无效,如果点击别的门店分销,则对于别的门店来说,不是代理,则要统计分销
//自己是代理,则点击链接无效
$w1['user_id'] = $my_user_id;
$w1['verification_store_id'] = $param['store_id'];
//$w1['verification_store_id'] = $param['store_id'];
$role = Db::name('verification_staff')->where($w1)->find();
if(in_array($role['type'],['1','3'])){
return $this->error('我是代理不记录');
}
Db::name('user')->where($w)->update(['id'=>$myInfo['pid']]);
Db::name('user')->where($w)->update(['pid'=>$param['share_id']]);
return $this->success('更新关系');
}else{
if($myInfo['pid'] == $param['share_id']){
... ... @@ -327,7 +328,7 @@ class Wechat extends Api
$app = WehcatModule::getInstance()->initWechatPay();
$xml = file_get_contents("php://input");
$xmljson= json_encode(simplexml_load_string($xml, 'SimplexmlElement', LIBXML_NOCDATA ));//将对象转换个JSON
Common::put_file_log('支付回调记录-微信支付回调信息',$xmljson, 'pay_notify', __CLASS__ . __FUNCTION__ . __LINE__);
file_put_contents('1_notify.log',($xmljson),FILE_APPEND);
$response = $app->handlePaidNotify(function($message, $fail){
// 使用通知里的 "微信支付订单号" 或者 "商户订单号" 去自己的数据库找到订单
Common::put_file_log('支付成功-微信支付回调信息',json_encode($message), 'pay_notify', __CLASS__ . __FUNCTION__ . __LINE__);
... ...