|
@@ -314,7 +314,7 @@ class User extends Api
|
|
|
'height','weight','bio',
|
|
|
'marital_id','job_id','wages_id','suqiu_id','tag_ids','hobby_ids',
|
|
|
'hide_is_finishinfo',
|
|
|
- 'open_match_video','open_match_audio','match_video_price','match_audio_price','match_typing_price'
|
|
|
+
|
|
|
];
|
|
|
|
|
|
$data = [];
|
|
@@ -886,6 +886,84 @@ class User extends Api
|
|
|
}
|
|
|
|
|
|
|
|
|
+ //文字语音视频收费设置
|
|
|
+ public function chargeconfig() {
|
|
|
+ $type = input('type', 0, 'intval'); //类型:0=文字,1=语音,2=视频
|
|
|
+ if (!in_array($type, [0, 1, 2])) {
|
|
|
+ $this->error('您的网络开小差啦~');
|
|
|
+ }
|
|
|
+
|
|
|
+ $where['type'] = $type;
|
|
|
+ $where['level'] = ['elt',$this->auth->charm_level];
|
|
|
+
|
|
|
+ $list = Db::name('charge_config')->field('id, price, level')->where($where)->order('price asc')->select();
|
|
|
+
|
|
|
+ $this->success('success', $list);
|
|
|
+ }
|
|
|
+
|
|
|
+ //文字语音视频收费/隐藏所在位置设置
|
|
|
+ public function chargeset() {
|
|
|
+ $chat_id = input('chat_id', 0, 'intval'); //文字收费id
|
|
|
+ $voice_id = input('voice_id', 0, 'intval'); //语音收费id
|
|
|
+ $video_id = input('video_id', 0, 'intval'); //视频收费id
|
|
|
+
|
|
|
+ $open_match_audio = input('open_match_audio', -1, 'intval'); //是否开启语音:1是 0否
|
|
|
+ $open_match_video = input('open_match_video', -1, 'intval'); //是否开启视频:1是 0否
|
|
|
+
|
|
|
+ $data = [];
|
|
|
+ //查询我的魅力等级
|
|
|
+ $level = $this->auth->charm_level;
|
|
|
+
|
|
|
+ if ($chat_id) {
|
|
|
+ $charge_config = Db::name('charge_config')->where(['id' => $chat_id, 'type' => 0])->find();
|
|
|
+ if (!$charge_config) {
|
|
|
+ $this->error('您的网络开小差啦~');
|
|
|
+ }
|
|
|
+ if ($level < $charge_config['level']) {
|
|
|
+ $this->error('您还未满足条件~');
|
|
|
+ }
|
|
|
+
|
|
|
+ $data['match_typing_price'] = $charge_config['price'];
|
|
|
+ }
|
|
|
+ if ($voice_id) {
|
|
|
+ $charge_config = Db::name('charge_config')->where(['id' => $voice_id, 'type' => 1])->find();
|
|
|
+ if (!$charge_config) {
|
|
|
+ $this->error('您的网络开小差啦~');
|
|
|
+ }
|
|
|
+ if ($level < $charge_config['level']) {
|
|
|
+ $this->error('您还未满足条件~');
|
|
|
+ }
|
|
|
+
|
|
|
+ $data['match_audio_price'] = $charge_config['price'];
|
|
|
+ }
|
|
|
+ if ($video_id) {
|
|
|
+ $charge_config = Db::name('charge_config')->where(['id' => $video_id, 'type' => 2])->find();
|
|
|
+ if (!$charge_config) {
|
|
|
+ $this->error('您的网络开小差啦~');
|
|
|
+ }
|
|
|
+ if ($level < $charge_config['level']) {
|
|
|
+ $this->error('您还未满足条件~');
|
|
|
+ }
|
|
|
|
|
|
+ $data['match_video_price'] = $charge_config['price'];
|
|
|
+ }
|
|
|
+ if (in_array($open_match_audio, [1, 0])) {
|
|
|
+ $data['open_match_audio'] = $open_match_audio;
|
|
|
+ }
|
|
|
+ if (in_array($open_match_video, [1, 0])) {
|
|
|
+ $data['open_match_video'] = $open_match_video;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!$data) {
|
|
|
+ $this->error('没有修改信息~');
|
|
|
+ }
|
|
|
+
|
|
|
+ $rs = Db::name('user')->where(['id' => $this->auth->id])->setField($data);
|
|
|
+ if ($rs === false) {
|
|
|
+ $this->error('您的网络开小差啦~');
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('设置成功');
|
|
|
+ }
|
|
|
|
|
|
}
|