|
@@ -960,6 +960,42 @@ class ElectPool Extends Model
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 想认识支付
|
|
|
+ */
|
|
|
+ public static function wantKnowPay($user_id){
|
|
|
+ $user = app()->session->get('us');
|
|
|
+ $userinfo = User::get($user['id']);
|
|
|
+ $touser = Db::name('User')->where('id',$user_id)->find();
|
|
|
+ if (!$touser)
|
|
|
+ return Common::return_error('用户不存在');
|
|
|
+ $pay = UserPay::where('user_id',$user['id'])->where('to_user_id',$user_id)->find();
|
|
|
+ if ($pay)
|
|
|
+ return Common::return_error('已经支付过');
|
|
|
+
|
|
|
+
|
|
|
+ $integral = Config::get_values('want_know_integral'); //扣除的积分
|
|
|
+ if ($userinfo['integral'] < $integral)
|
|
|
+ return Common::return_error('积分不足');
|
|
|
+
|
|
|
+ $data['user_id'] = $user['id'];
|
|
|
+ $data['to_user_id'] = $user_id;
|
|
|
+ Db::startTrans();
|
|
|
+ try {
|
|
|
+ User::integral($integral,$user['id'],'想查看 '.$touser['nickname'].'资料');
|
|
|
+ $data['integral'] = $integral;
|
|
|
+ UserPay::create($data);
|
|
|
+ Db::commit();
|
|
|
+ return Common::return_success('成功');
|
|
|
+ }catch (Exception $e) {
|
|
|
+ Db::rollback();
|
|
|
+ return Common::return_error('失败');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 想认识
|
|
|
*/
|
|
@@ -974,9 +1010,9 @@ class ElectPool Extends Model
|
|
|
if (!User::checkUserIformationPerfect($user['id']))
|
|
|
return Common::return_error('未完善资料,无法获取');
|
|
|
|
|
|
- $integral = Config::get_values('want_know_integral'); //扣除的积分
|
|
|
- if ($userinfo['integral'] < $integral)
|
|
|
- return Common::return_error('积分不足');
|
|
|
+// $integral = Config::get_values('want_know_integral'); //扣除的积分
|
|
|
+// if ($userinfo['integral'] < $integral)
|
|
|
+// return Common::return_error('积分不足');
|
|
|
|
|
|
//查看我是否已经喜欢过
|
|
|
$want_know = UserWantKnow::where('user_id',$user['id'])->where('to_user_id',$user_id)->count();
|
|
@@ -987,11 +1023,8 @@ class ElectPool Extends Model
|
|
|
$data['pool_id'] = $pool_id;
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
- User::integral($integral,$user['id'],'想查看 '.$touser['nickname'].'资料');
|
|
|
- $data['integral'] = $integral;
|
|
|
$knowid = UserWantKnow::create($data);
|
|
|
|
|
|
-
|
|
|
//消息推送
|
|
|
// $openid = User::where('id',$user_id)->value('openid');
|
|
|
$openid = User::where('administrator',1)->where('is_del',1)->order('id asc')->limit(1)->value('openid');
|