12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- <?php
- declare (strict_types=1);
- namespace app\dao\wechat;
- use think\model;
- use app\dao\BaseDao;
- use app\model\wechat\WechatReply;
- class WechatReplyDao extends BaseDao
- {
-
- protected function setModel(): string
- {
- return WechatReply::class;
- }
-
- public function getKey($key)
- {
- $res = $this->getModel()->whereIn('id', function ($query) use ($key) {
- $query->name('wechat_key')->where('keys', $key)->field(['reply_id'])->select();
- })->where('status', '1')->find();
- if (empty($res)) {
- $res = $this->getModel()->whereIn('id', function ($query) use ($key) {
- $query->name('wechat_key')->where('keys', 'default')->field(['reply_id'])->select();
- })->where('status', '1')->find();
- }
- return $res;
- }
- }
|