|
@@ -69,6 +69,7 @@ class MengbaoLogic extends BaseLogic
|
|
|
$this->responseSuccess($data,'萌宝资料');
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 获取活动状态
|
|
|
* @return [type] [description]
|
|
@@ -138,15 +139,7 @@ class MengbaoLogic extends BaseLogic
|
|
|
//更新萌宝获得总票数
|
|
|
M('activity_mengbao')->where(['id'=>$mengbao_id])->setInc('score',$score);
|
|
|
|
|
|
- $where = [
|
|
|
- 'uid'=>$this->uid,
|
|
|
- 'created_at'=>['gt','2020-01-15'],
|
|
|
- 'product_id'=>'365',
|
|
|
- 'pay_result'=>0
|
|
|
- ];
|
|
|
- $is_year_vip = M('iptv_order')->where($where)->find();
|
|
|
-
|
|
|
- if($is_year_vip){
|
|
|
+ if($this->vip_level==2){
|
|
|
//已投票数
|
|
|
$vip_vote = M('activity_vip_vote')->where(['uid'=>$this->uid,'act_id'=>$this->act_id])->field('id,num')->find();
|
|
|
$alrady_vip_vote = $vip_vote['num'] ? : 0;
|
|
@@ -175,6 +168,84 @@ class MengbaoLogic extends BaseLogic
|
|
|
|
|
|
$this->responseSuccess(['num'=>$remain_chance],'投票成功,去参与抽奖吧');
|
|
|
}
|
|
|
+
|
|
|
+ /**ascii码从小到大排序
|
|
|
+ * @param array $params
|
|
|
+ * @return bool|string
|
|
|
+ */
|
|
|
+ function asc_sort($params = array())
|
|
|
+ {
|
|
|
+ if (!empty($params)) {
|
|
|
+ $p = ksort($params);
|
|
|
+ if ($p) {
|
|
|
+ $str = '';
|
|
|
+ foreach ($params as $k => $val) {
|
|
|
+ $str .= $k . '=' . $val . '&';
|
|
|
+ }
|
|
|
+ $strs = rtrim($str, '&');
|
|
|
+ return $strs;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function checkYearVip(){
|
|
|
+ $uid = $this->uid;
|
|
|
+ $ip = get_client_ip();
|
|
|
+ $mac = I('mac');
|
|
|
+ $version = I('version');
|
|
|
+ $params = [
|
|
|
+ 'userid'=>$uid,
|
|
|
+ 'skuid'=>'30441',
|
|
|
+ 'stime'=>'20200116000000',
|
|
|
+ 'etime'=>'20201231000000',
|
|
|
+ 'business_id'=>'1',
|
|
|
+ 'ip'=>$ip,
|
|
|
+ 'mac'=>$mac
|
|
|
+ ];
|
|
|
+
|
|
|
+ if(empty($uid) || empty($mac) || empty($version)){
|
|
|
+ $this->responseError('检查uid mac version 参数',-1);
|
|
|
+ }
|
|
|
+
|
|
|
+ $data_json = json_encode($params,JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
|
|
|
+
|
|
|
+ $asc_sort_arr = [
|
|
|
+ 'version'=>$version,
|
|
|
+ 'data'=>$data_json
|
|
|
+ ];
|
|
|
+
|
|
|
+
|
|
|
+ $asc_sort = $this->asc_sort($asc_sort_arr);
|
|
|
+
|
|
|
+ $secret_key = '82dawe3ihz!@~5d32s(*%aaa(#aa&jy$';
|
|
|
+ $params_string = strtolower($asc_sort.'&secret_key='.$secret_key);
|
|
|
+
|
|
|
+ $sign = sha1($params_string);
|
|
|
+ $request_string = 'sign='.$sign.'&version='.$version.'&data='.$data_json;
|
|
|
+
|
|
|
+ //测试地址
|
|
|
+ $url = 'http://10.2.204.141:8081/cms/ever_active_product';
|
|
|
+ $ch = curl_init($url);
|
|
|
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
|
|
|
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
|
|
|
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $request_string); //设置提交的字符串
|
|
|
+ $output = curl_exec($ch);
|
|
|
+ $error_num = curl_errno($ch);
|
|
|
+ curl_close($ch);
|
|
|
+ if($error_num){
|
|
|
+ Writelog($error_num,'error_num','curl_error');
|
|
|
+ $this->responseError('服务异常', -1);
|
|
|
+ }
|
|
|
+ // $output = '{"msg":"是活动内订购","err":"0","status":"1111"}';
|
|
|
+ $return = json_decode($output,true);
|
|
|
+ if($return['status']== '0000'){
|
|
|
+ $this->responseSuccess(['status'=>0],'is year_vip');
|
|
|
+ }else{
|
|
|
+ $this->responseSuccess(['status'=>2],'is not year_vip');
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -189,15 +260,8 @@ class MengbaoLogic extends BaseLogic
|
|
|
}
|
|
|
|
|
|
$add = 0;
|
|
|
- $where = [
|
|
|
- 'uid'=>$this->uid,
|
|
|
- 'created_at'=>['gt','2020-01-15'],
|
|
|
- 'product_id'=>'365',
|
|
|
- 'pay_result'=>0
|
|
|
- ];
|
|
|
- $is_year_vip = M('iptv_order')->where($where)->find();
|
|
|
|
|
|
- if($is_year_vip){
|
|
|
+ if($this->vip_level ==2){
|
|
|
$num = M('activity_vip_vote')->where(['uid'=>$this->uid,'act_id'=>$this->act_id])->getField('num');
|
|
|
|
|
|
if($num === null){
|