| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 | <?phpnamespace app\api\controller;use app\common\controller\Api;use think\Db;class PlatformArticle extends Api{    protected $noNeedLogin = [];    protected $noNeedRight = '*';    protected $model = null;    public function _initialize()    {        parent::_initialize();        $this->model = Db::name('platform_article');    }    /**     * 分类列表     * @return void     */    public function getTypeList()    {        try {            $companyId = $this->request->param('company_id',0);            $position = $this->request->param('position',0);//位置:0=首页,1=门店印象            $field = 'id,title,image,url';            $where['status'] = 1;            $where['position'] = $position;            $where['company_id'] = $companyId;            $result = $this->model->field($field)->where($where)->order('weigh asc')->select();            if (!empty($result)) {                foreach ($result as $key => &$value) {                    !empty($value['image']) && $value['image'] = cdnurl($value['image']);                }            }            $this->success('获取成功',$result);        } catch (Exception $e) {            $this->error($e->getMessage());        }    }}
 |