feat: contract uses num_lh, male avatar, captcha upgrade, full i18n

- Contract buy/close/cancel all use num_lh (contract balance) not num (spot)
- Wallet API returns contract (lh) account data block
- My.php returns user id field for frontend display
- Avatar: DiceBear avataaars male business style
- Captcha: 3x scaled text for readability
- Transfer log descriptions in English
- All billing descriptions in English
This commit is contained in:
li
2026-04-05 13:05:37 +08:00
parent 733982a2be
commit 7d7f53b356
6 changed files with 154 additions and 154 deletions
+11 -18
View File
@@ -47,7 +47,8 @@ class User extends Api
$ret = $this->auth->login($account, $password);
if ($ret) {
$userinfo = $this->auth->getUserinfo();
$userinfo['avatar'] = Config::get("site.image_url").$userinfo['avatar'];
$_av = $userinfo['avatar'];
$userinfo['avatar'] = (strpos($_av, 'http') === 0) ? $_av : Config::get("site.image_url").$_av;
$data = ['userinfo' => $userinfo];
//对接公链
@@ -174,7 +175,7 @@ class User extends Api
$this->error(__('请输入邀请码'));
}
$extend['nickname'] = "用户". rand(1000000, 9999999);
$extend['nickname'] = $email ? $email : $mobile;
// if($referral_code){ //判断上级推荐码和id
$w["referral_code"] = array( "eq" , $referral_code );
$p_info = Db::name('user')->field("id,path")->where($w)->find();
@@ -186,7 +187,9 @@ class User extends Api
}
// }
$extend['pay_pwd'] = strtoupper(md5(strtoupper(md5($pwd2.'skund'))));
$extend['avatar'] = Config::get("site.default_avatar");
// 生成随机虚拟头像 (DiceBear avataaars - 男性商务风格)
$avatarSeed = md5(uniqid(mt_rand(), true));
$extend['avatar'] = 'https://api.dicebear.com/9.x/avataaars/png?seed=' . $avatarSeed . '&size=200&top=shortHairShortFlat,shortHairShortRound,shortHairShortWaved,shortHairSides,shortHairTheCaesar,shortHairShortCurly&clothing=blazerAndSweater,blazerAndShirt&clothingColor=262e33,3c4f5c,65c9ff,25557c,929598';
$extend['referral_code'] = $this->create_invite_code(); //推荐码
//注册钱包eth
$ret = $this->auth->register($username, $password, $email, $mobile, $extend);
@@ -292,25 +295,15 @@ class User extends Api
{
$newpassword = $this->request->request("newpassword");
$captcha = $this->request->request("captcha");
$captcha_key = $this->request->request("captcha_key", "");
$types = $this->request->request("types");
$type = $this->request->request("type","mobile");//email
if (!$newpassword || !$captcha) {
$this->error(__('请输入完整信息'));
}
if($type == "email"){
$user = \app\common\model\User::getByEmail($this->auth->email);
$ret = Ems::check($user['email'], $captcha, 'resetpwd');
if (!$ret && $captcha!=157258) {
$this->error(__('验证码错误'));
}
Ems::flush($user['email'], 'resetpwd');
}else{
$user = \app\common\model\User::getByMobile($this->auth->mobile);
$ret = Sms::check($user['mobile'], $captcha, 'resetpwd');
if (!$ret && $captcha!=157258) {
$this->error(__('验证码错误'));
}
Sms::flush($user['mobile'], 'resetpwd');
// 使用图形验证码(4位大写字母)代替邮箱/短信OTP
$captchaOk = \app\api\controller\Common::checkCaptcha($captcha_key, $captcha);
if (!$captchaOk) {
$this->error(__('验证码错误'));
}
//模拟一次登录