|
@@ -1562,4 +1562,66 @@ class Money extends Common
|
|
|
$this->success("获取成功!",$result);
|
|
|
}
|
|
|
|
|
|
+ ////////////////////////////////////
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 消息-聊天-更多-转账-钻石
|
|
|
+ */
|
|
|
+ public function givejeweltouser(){
|
|
|
+ $money = intval(input('money',0));
|
|
|
+ $user_id = input('user_id',0);
|
|
|
+ $pay_password = input('paypassword','');
|
|
|
+
|
|
|
+ //验证用户权限是否能转账
|
|
|
+ if($this->auth->power->transfer == 1){
|
|
|
+ $this->error('您已经被限制消费-转账');
|
|
|
+ }
|
|
|
+ //验证被转账用户存在
|
|
|
+ $check = Db::name('user')->where('id',$user_id)->find();
|
|
|
+ if(empty($check)){
|
|
|
+ $this->error('不存在的用户');
|
|
|
+ }
|
|
|
+ //验证操作密码
|
|
|
+ if(!$this->auth->pay_password){
|
|
|
+ $this->error('请先设置支付密码');
|
|
|
+ }
|
|
|
+ if ($this->auth->pay_password != $this->getEncryptPassword($pay_password, $this->auth->pay_salt)) {
|
|
|
+ $this->error('支付密码有误');
|
|
|
+ }
|
|
|
+
|
|
|
+ Db::startTrans();
|
|
|
+ /*//验证余额
|
|
|
+ $userwallet = Db::name('user')->where('id',$this->auth->id)->lock(true)->find();
|
|
|
+ if($userwallet['jewel'] < $money){
|
|
|
+ Db::rollback();
|
|
|
+ $this->error('余额不足');
|
|
|
+ }*/
|
|
|
+ //减少和增加余额
|
|
|
+ $rs_wallet = model('wallet')->lockChangeAccountRemain($this->auth->id,$money,'-',0,'私聊转账给:'.$check['nickname'],11,'jewel');
|
|
|
+ if($rs_wallet['status'] === false){
|
|
|
+ Db::rollback();
|
|
|
+ $this->error($rs_wallet['msg']);
|
|
|
+ }
|
|
|
+
|
|
|
+ $rs_wallet = model('wallet')->lockChangeAccountRemain($user_id,$money,'+',0,$this->auth->nickname.':私聊到账',12,'jewel');
|
|
|
+ if($rs_wallet['status'] === false){
|
|
|
+ Db::rollback();
|
|
|
+ $this->error($rs_wallet['msg']);
|
|
|
+ }
|
|
|
+
|
|
|
+ Db::commit();
|
|
|
+ $this->success('转账成功');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取密码加密后的字符串
|
|
|
+ * @param string $password 密码
|
|
|
+ * @param string $salt 密码盐
|
|
|
+ * @return string
|
|
|
+ */
|
|
|
+ private function getEncryptPassword($password, $salt = '')
|
|
|
+ {
|
|
|
+ return md5(md5($password) . $salt);
|
|
|
+ }
|
|
|
+
|
|
|
}
|