作者 chencheng

0531-1

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