* @date 2017/03/27 14:43 */ class Fans extends BasicAdmin { /** * 定义当前默认数据表 * @var string */ protected $table = 'WechatFans'; /** * 显示粉丝列表 * @return array|string */ public function index() { $this->title = '微信粉丝管理'; $db = Db::name($this->table); $get = $this->request->get(); foreach (['nickname'] as $key) { if (isset($get[$key]) && $get[$key] !== '') { $db->where($key, 'like', "%{$get[$key]}%"); } } return parent::_list($db); } /** * 同步粉丝列表 */ public function sync() { Db::name($this->table)->where('1=1')->delete(); if (WechatService::syncAllFans('')) { LogService::write('微信管理', '同步全部微信粉丝成功'); $this->success('同步获取所有粉丝成功!', ''); } $this->error('同步获取粉丝失败,请稍候再试!'); } }