12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- namespace app\api\controller;
- use app\common\controller\UserApi;
- use app\common\model\Mobile;
- use stdClass;
- use think\Env;
- /**
- * 民生号码
- * @ApiInternal
- */
- class Exchange extends UserApi
- {
- protected $noNeedLogin='*';
- /**
- * 民生号码下架
- * */
- public function ms_no_down(){
- $key=Env::get('api_config.minsheng_key','aallsoJJDAG87ADAnna');
- $secret=Env::get('api_config.minsheng_secret','adakda2313BAALPOjjada12');
- $info=new stdClass;
- $tid=input('tid')?:session_create_id();
- $sign1=$this->request->post('sign');
- $post=$this->request->post();
- $no=$post['param']['msisdn']??null;
- $params=$post['param']??[];
- user_log('no_api/minsheng',$post);
- $base641=base64_encode($key);
- $base642=base64_encode($tid.$secret);
- ksort($params);
- $base643=base64_encode(json_encode($params,256));
- $sign2=md5($base642.$base641.$base643);
- if($sign1!=$sign2){
- $info->msg='签名有误';
- goto END;
- }
- if($no){
- $mobiles=Mobile::where('no',$no)->select();
- foreach ($mobiles as $mobile){
- $mobile['status']=$mobile::S_DOWN;
- $mobile->save();
- }
- }
- END:
- $this->result('success',$info,10200);
- }
- }
|