master
ELF 5 years ago
parent d29984aaeb
commit 1931bd6197

@ -18,6 +18,7 @@
namespace Home\Controller;
use Think\Controller;
use User\Api\MemberApi;
/**
* 前台公共控制器
@ -192,4 +193,60 @@ class HomeController extends Controller
$this->assign('data', $data);
$this->display();
}
public function register()
{
$userApi = new MemberApi();
$id = $userApi->wap_register($_POST);
if ($id > 0) {
$this->add_user_play($_POST);
$this->ajaxReturn([
'status' => true,
'msg' => '注册成功'
]);
} else {
$this->ajaxReturn([
'status' => false,
'msg' => '数据有误'
]);
}
}
/**
*添加玩家信息
*/
private function add_user_play($user = array())
{
$user_play = M("UserPlay", "tab_");
$map["game_id"] = $user["game_id"];
$map["user_id"] = $user["user_id"];
$map['sdk_version'] = $user['sdk_version'];
$res = $user_play -> where($map) -> find();
if (empty($res)) {
$user_entity = get_user_entity($user["user_id"]);
$data["user_id"] = $user["user_id"];
$data["user_account"] = $user_entity["account"];
$data["user_nickname"] = $user_entity["nickname"];
$data["game_id"] = $user["game_id"];
$data["game_appid"] = $user["game_appid"];
$data["game_name"] = get_game_name($user["game_id"]);
$data["server_id"] = 0;
$data["server_name"] = "";
$data["role_id"] = 0;
$data['parent_id'] = $user_entity["parent_id"];
$data['parent_name'] = $user_entity["parent_name"];
$data["role_name"] = "";
$data["role_level"] = 0;
$data["bind_balance"] = 0;
$data["promote_id"] = $user_entity["promote_id"];
$data["promote_account"] = $user_entity["promote_account"];
$data['play_time'] = time();
$data['play_ip'] = get_client_ip();
$data["sdk_version"] = $user["sdk_version"];
$data['ppuid'] = $user['puid'] == '' ? 0 : $user['puid'];
$data['check_time'] = time();
$user_play -> add($data);
}
}
}

@ -29,9 +29,14 @@ class MemberApi extends Api{
return $this->model->register($data);
}
public function sdk_register($data){
public function sdk_register($data){
return $this->model->sdk_register($data);
}
public function wap_register($data){
return $this->model->wap_register($data);
}
/**
* 注册一个新用户user表加game_id
* @param string $account 用户名

Loading…
Cancel
Save