find($app_id); if (!empty($detail['pay_type'])) { $detail['pay_type'] = json_decode($detail['pay_type'], true); } return $detail; } /** * 从缓存中获取app信息 */ public static function getAppCache($app_id = null) { if (is_null($app_id)) { $self = new static(); $app_id = $self::$app_id; } if (!$data = Cache::get('app_' . $app_id)) { $data = self::detail($app_id); if (empty($data)) throw new BaseException(['msg' => '未找到当前应用信息']); Cache::tag('cache')->set('app_' . $app_id, $data); } return $data; } /** * 启用商城 * @return bool */ public function updateStatus() { return $this->allowField(['is_recycle'])->save([ 'is_recycle' => !$this['is_recycle'], ]); } /** * 所有商城 */ public static function getAll() { return (new self())->where('is_delete', '=', 0) ->where('is_recycle', '=', 0) ->select(); } public static function getPayType($app_id, $pay_source) { log_write('$pay_source'.$pay_source); $detail = self::detail($app_id); if (empty($detail['pay_type'])) { return PlatformEnum::data()[$pay_source]['pay_type']; } else { return $detail['pay_type'][$pay_source]['pay_type']; } } }