<?php
/**
 * 常用接口
 */
namespace app\ais\controller\api\v1;
use app\ais\controller\api\Base;
use app\ais\model\AisAdwords;

class Index extends Base{

    /**
     * 广告图片
     * @return void
     */
    public function adwords(){
        $param['ids'] = $this->request->param('ids');
        $this->apiSign($param);
        $group = explode('/',$param['ids']);
        $adword = [];
        foreach ($group as $value) {
            $adword[$value] = [];
        }
        $rel = AisAdwords::where(['member_miniapp_id' => $this->miniapp_id,'group' => $group])->field('title,picture,link,open_type,group')->order('sort desc,id desc')->select();
        foreach ($rel as $rs) {
            $adword[$rs['group']][] = $rs;
        }
        return enjson(200,$adword);
    }
}