| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 | <?phpnamespace app\api\controller;use app\common\controller\Api;use think\Db;use addons\epay\library\Service;/** * 首页产品文章 */class Article extends Api{    protected $noNeedLogin = ['*'];    protected $noNeedRight = ['*'];    public function lists()    {        $where = ['is_show'=>1];        $list = Db::name('article')->field('content',true)->where($where)->order('weigh desc')->autopage()->select();        $list = list_domain_image($list,['images','video_file','video_image']);        if(!empty($list)){            foreach($list as $key => &$item){                $item['showdate'] = date('Y-m-d H:i',$item['showtime']);            }        }        $this->success(1,$list);    }    public function info(){        $id = input('id',0);        $info = Db::name('article')->where('is_show',1)->where('id',$id)->find();        if(!$info){            $this->error('文章找不到了');        }        $info = info_domain_image($info,['images','video_file','video_image']);        $info['showdate'] = date('Y-m-d H:i',$info['showtime']);        $this->success(1,$info);    }}
 |