|
@@ -85,28 +85,7 @@ class User extends Api
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //非首次注册男性用户每次打开app,系统自动推送女性(公会)打招呼消息3人次。
|
|
|
- private function firstopen_send($oneuser){
|
|
|
- //找出公会的人
|
|
|
- $map = [
|
|
|
- 'gh_id' => ['gt',0],
|
|
|
- 'gender' => 0,
|
|
|
- ];
|
|
|
- $ghuser = Db::name('user')->where($map)->orderRaw('rand()')->limit(3)->column('id');
|
|
|
- //dump($ghuser);
|
|
|
-
|
|
|
- //随机取出一句话
|
|
|
- $oneword = Db::name('plantask_accost')->orderRaw('rand()')->limit(3)->column('title');
|
|
|
- //dump($oneword);
|
|
|
-
|
|
|
- $tenim = new \app\common\library\Tenim;
|
|
|
|
|
|
- for($i = 0;$i < 3;$i++){
|
|
|
- $ghuser_one = isset($ghuser[$i]) ? $ghuser[$i] : $ghuser[array_rand($ghuser)];
|
|
|
- $oneword_one = isset($oneword[$i]) ? $oneword[$i] : $oneword[array_rand($oneword)];
|
|
|
- $tenim->sendMessageToUser($ghuser_one,$oneuser,$oneword_one);
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 手机验证码登录
|
|
@@ -987,10 +966,6 @@ class User extends Api
|
|
|
$this->success();
|
|
|
}
|
|
|
|
|
|
- public function set_status_switch(){
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
/*
|
|
|
* 修改用户的坐标
|
|
|
* */
|
|
@@ -1011,40 +986,6 @@ class User extends Api
|
|
|
$this->success();
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 修改邮箱
|
|
|
- *
|
|
|
- * @ApiMethod (POST)
|
|
|
- * @param string $email 邮箱
|
|
|
- * @param string $captcha 验证码
|
|
|
- */
|
|
|
- /*public function changeemail()
|
|
|
- {
|
|
|
- $user = $this->auth->getUser();
|
|
|
- $email = $this->request->post('email');
|
|
|
- $captcha = $this->request->post('captcha');
|
|
|
- if (!$email || !$captcha) {
|
|
|
- $this->error(__('Invalid parameters'));
|
|
|
- }
|
|
|
- if (!Validate::is($email, "email")) {
|
|
|
- $this->error(__('Email is incorrect'));
|
|
|
- }
|
|
|
- if (\app\common\model\User::where('email', $email)->where('id', '<>', $user->id)->find()) {
|
|
|
- $this->error(__('Email already exists'));
|
|
|
- }
|
|
|
- $result = Ems::check($email, $captcha, 'changeemail');
|
|
|
- if (!$result) {
|
|
|
- $this->error(__('Captcha is incorrect'));
|
|
|
- }
|
|
|
- $verification = $user->verification;
|
|
|
- $verification->email = 1;
|
|
|
- $user->verification = $verification;
|
|
|
- $user->email = $email;
|
|
|
- $user->save();
|
|
|
-
|
|
|
- Ems::flush($email, 'changeemail');
|
|
|
- $this->success();
|
|
|
- }*/
|
|
|
|
|
|
/**
|
|
|
* 修改手机号
|
|
@@ -1163,38 +1104,7 @@ class User extends Api
|
|
|
$this->success('success',$this->userInfo('return'));
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 第三方登录
|
|
|
- *
|
|
|
- * @ApiMethod (POST)
|
|
|
- * @param string $platform 平台名称
|
|
|
- * @param string $code Code码
|
|
|
- */
|
|
|
- /*public function third()
|
|
|
- {
|
|
|
- $url = url('user/index');
|
|
|
-// $platform = $this->request->post("platform");
|
|
|
- $platform = 'wechat';
|
|
|
- $code = $this->request->post("code");
|
|
|
- $config = get_addon_config('third');
|
|
|
- if (!$config || !isset($config[$platform])) {
|
|
|
- $this->error(__('Invalid parameters'));
|
|
|
- }
|
|
|
- $app = new \addons\third\library\Application($config);
|
|
|
- //通过code换access_token和绑定会员
|
|
|
- $result = $app->{$platform}->getUserInfo(['code' => $code]);
|
|
|
- if ($result) {
|
|
|
- $loginret = \addons\third\library\Service::connect($platform, $result);
|
|
|
- if ($loginret) {
|
|
|
- $data = [
|
|
|
- 'userinfo' => $this->auth->getUserinfo(),
|
|
|
- 'thirdinfo' => $result
|
|
|
- ];
|
|
|
- $this->success(__('Logged in successful'), $data);
|
|
|
- }
|
|
|
- }
|
|
|
- $this->error(__('Operation failed'), $url);
|
|
|
- }*/
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 重置密码
|
|
@@ -1345,100 +1255,6 @@ class User extends Api
|
|
|
$this->success('success');
|
|
|
}
|
|
|
|
|
|
- //APP 转化数据统计方案(即:APP 上报对接方案): 广告主上报激活数据,亿米平台搭建服务系统关联点击&下载数据和广告主提供的所有激活数据,将激活数据归因到对应广告。
|
|
|
- public function yimi_advert(){
|
|
|
- //http://trail.e.mi.com/global/log?appId={appid}&info={data}&conv_type={convType}&customer_id={customerId}
|
|
|
- $api_url = 'http://trail.e.mi.com/global/log?';
|
|
|
- $api_url_test = 'http://trail.e.mi.com/global/test?';
|
|
|
-
|
|
|
- //应用id 1453045
|
|
|
- //秘钥A(encrypt_key):ZxdIaVHvFqSQYzWD
|
|
|
- //秘钥B(sign_key):uaeWeunykLRnkyLw
|
|
|
- $sign_key = 'uaeWeunykLRnkyLw'; //真的
|
|
|
- $encrypt_key = 'ZxdIaVHvFqSQYzWD';//真的
|
|
|
-
|
|
|
- $appid = '1453045';
|
|
|
- $conv_type = 'APP_REGISTER';
|
|
|
- $customer_id = '292232';
|
|
|
-
|
|
|
- //推荐模式
|
|
|
- /*$imei = md5('imei');
|
|
|
- $data = [
|
|
|
- 'imei' => '91b9185dba1772851dd02b276a6c969e',
|
|
|
- 'oaid' => '5fb96f268628810c',
|
|
|
- 'conv_time' => '1504687208890',
|
|
|
- 'client_ip' => '127.0.0.1',
|
|
|
- 'ua' => 'Dalvik/2.1.0 (Linux; U; Android 11; M2012K11AC Build/RKQ1.200826.002)',
|
|
|
- ];*/
|
|
|
-
|
|
|
- //采用模式4
|
|
|
- /*
|
|
|
- $ua = input('ua','','trim');
|
|
|
- if(empty($ua)){
|
|
|
- return true;
|
|
|
- }
|
|
|
- $data = [
|
|
|
- 'conv_time' => time().substr(microtime(),2,3),
|
|
|
- 'client_ip' => request()->ip(),
|
|
|
- 'ua' => $ua,
|
|
|
- ];
|
|
|
- */
|
|
|
-
|
|
|
- //采用模式3
|
|
|
- $oaid = input('oaid','','trim');
|
|
|
- if(empty($oaid)){
|
|
|
- return true;
|
|
|
- }
|
|
|
- $data = [
|
|
|
- 'oaid' => $oaid,
|
|
|
- 'conv_time' => time().substr(microtime(),2,3),
|
|
|
- 'client_ip' => request()->ip(),
|
|
|
- ];
|
|
|
-
|
|
|
- $data_query = http_build_query($data);
|
|
|
- //dump($data_query);
|
|
|
-
|
|
|
- $property = $sign_key.'&'.urlencode($data_query);
|
|
|
- //dump($property);
|
|
|
-
|
|
|
- $signature = md5($property);
|
|
|
- //dump($signature);
|
|
|
-
|
|
|
- $base_data = $data_query .'&sign='.urlencode($signature);
|
|
|
- //echo $base_data;
|
|
|
-
|
|
|
- $info = urlencode(base64_encode($this->xor_enc($base_data, $encrypt_key)));
|
|
|
- //dump($info);
|
|
|
-
|
|
|
- $request_url = $api_url.'appId='.$appid.'&info='.$info.'&customer_id='.$customer_id.'&conv_type='.$conv_type;
|
|
|
- //echo $request_url;
|
|
|
-
|
|
|
- $result = curl_get($request_url);
|
|
|
- //dump($result);
|
|
|
- //日志
|
|
|
- $log = [
|
|
|
- 'param' => $base_data,
|
|
|
- 'url' => $request_url,
|
|
|
- 'result'=> $result,
|
|
|
- 'createtime' => time(),
|
|
|
- ];
|
|
|
- Db::name('yimi_advert')->insertGetId($log);
|
|
|
-
|
|
|
- return true;
|
|
|
- }
|
|
|
-
|
|
|
- //亿米 异或加密,解密
|
|
|
- public function xor_enc($str,$key)
|
|
|
- {
|
|
|
- $crytxt = '';
|
|
|
- $keylen = strlen($key);
|
|
|
- for($i=0;$i<strlen($str);$i++)
|
|
|
- {
|
|
|
- $k = $i%$keylen;
|
|
|
- $crytxt .= $str[$i] ^ $key[$k];
|
|
|
- }
|
|
|
- return $crytxt;
|
|
|
- }
|
|
|
|
|
|
//公众号获取openid
|
|
|
public function getUserOpenid_gzh(){
|