|
|
@@ -250,7 +250,7 @@ class EnshrineService extends BaseService
|
|
|
case 1: // 祈福
|
|
|
$limitNum = ConfigService::make()->getConfigByCode('qifu_limit');
|
|
|
if($limitNum) {
|
|
|
- $num = $this->model::where(['user_id'=> $userId,'mark'=> 1,'status'=> 1])
|
|
|
+ $num = $this->model::where(['user_id'=> $userId,'type'=> 1,'mark'=> 1,'status'=> 1])
|
|
|
->count('id');
|
|
|
if($num >= $limitNum){
|
|
|
return message("最多只能同时供奉{$limitNum}尊佛像,请送圣后再操作", false);
|
|
|
@@ -324,6 +324,53 @@ class EnshrineService extends BaseService
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 新增牌位
|
|
|
+ * @param $userId
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function chaodu($userId){
|
|
|
+ $params = request()->all();
|
|
|
+
|
|
|
+ $memberInfo = MemberModel::where(['id'=> $userId,'mark'=> 1,'status'=> 1])
|
|
|
+ ->select(['id','nickname'])
|
|
|
+ ->first();
|
|
|
+ if(!$memberInfo){
|
|
|
+ return message('您的账号不可操作或已冻结,请联系客服', false);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 验证是否正在供奉该佛像
|
|
|
+ $limitNum = ConfigService::make()->getConfigByCode('chaodu_limit');
|
|
|
+ if($limitNum) {
|
|
|
+ $num = $this->model::where(['user_id'=> $userId,'type'=> 2,'mark'=> 1,'','status'=> 1])
|
|
|
+ ->count('id');
|
|
|
+ if($num >= $limitNum){
|
|
|
+ return message("最多只能同时超度{$limitNum}个牌位,请到期后再操作", false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $data = [
|
|
|
+ 'fo_id'=> 0,
|
|
|
+ 'type'=> 2,
|
|
|
+ 'user_id'=> $userId,
|
|
|
+ 'used_name'=> isset($params['used_name'])? trim($params['used_name']) : '',
|
|
|
+ 'user_name'=> isset($params['user_name'])? trim($params['user_name']) : '',
|
|
|
+ 'relation'=> isset($params['relation'])? trim($params['relation']) : '',
|
|
|
+ 'description'=> isset($params['description'])? trim($params['description']) : '',
|
|
|
+ 'image'=> isset($params['image'])? trim($params['image']) : '',
|
|
|
+ 'create_time'=> time(),
|
|
|
+ 'update_time'=> time(),
|
|
|
+ 'mark'=> 1,
|
|
|
+ 'status'=> 1,
|
|
|
+ ];
|
|
|
+
|
|
|
+ if($this->model::insertGetId($data)){
|
|
|
+ return message('超度成功',true);
|
|
|
+ }else{
|
|
|
+ return message('超度失败',true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 供奉操作记录
|
|
|
* @param $userId
|
|
|
* @return array
|