Files
youlegames/codes/agent/game/api/source/apis/commendpic.php
2026-03-15 01:27:05 +08:00

85 lines
2.7 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, PATCH, DELETE");
header("Access-Control-Allow-Headers: Content-Type, Authorization, Content-Length, X-Requested-With");
header("Access-Control-Allow-Credentials: true");
header("Content-Type: text/html; charset=utf-8");
/**
* 门店幻灯相关接口
*/
use phprs\util\Verify;
use phprs\util\exceptions\Forbidden;
use phprs\util\Logger;
use phprs\util\exceptions\NotFound;
use phprs\ezsql\Sql;
use phprs\util\exceptions\BadRequest;
require_once 'apiBase.php';
/**
*
* 幻灯片管理
* @path("/commendpic")
*/
class Commendpic extends apiBase {
/**
* 获取门店幻灯片(错误代码15051-15100)
* @route({"POST","/list"})
* @param({"devkey","$._POST.devkey"}) 开发者key
* @param({"market_key","$._POST.market_key"}) market_key
* @param({"sign","$._POST.sign"}) sign
* @throws({"phprs\util\exceptions\Forbidden","res", "403 Forbidden",{"error":"Forbidden"}}) cookie不可用
* @return("body")
*/
public function getCommendPicList($devkey='',$market_key='',$sign='') {
$result = array();
$verify_result = $this->verifyMarketApi($devkey);
if( is_error_api($verify_result) ){
return $verify_result;
}
if( empty($market_key) ) {
$result["error"] = '1';
$result["error_code"] = 11001;
$result["msg"] = "未传入market_key参数";
return $result;
}
$marketList = Sql::select('a.*')
->from('syweb_market a')
->where('a.market_key=?',$market_key)
->get($this->db ,null);
if( empty($marketList) || count($marketList)<=0 ) {
$result["error"] = '1';
$result["error_code"] = 11002;
$result["msg"] = "market_key无效";
return $result;
}
$marketList = $marketList[0];
$commendpicList = Sql::select('a.*')
->from('syweb_market_commend_pic a')
->where('a.market_key=?',$marketList["market_key"])
->get($this->db ,null);
if( !empty($commendpicList) && count($commendpicList)>0 ) {
foreach ($commendpicList as &$picInfo) {
$picInfo["pic_path"] = "http://open.tscce.cn".$picInfo["pic_path"];
}
}
$result["error"] = '0';
$result["data"] = $commendpicList;
$result["msg"] = "获取门店轮播信息成功!";
return $result;
}
/** @inject("ioc_factory") */
private $factory;
/**
* @property({"default":"@db"})
* @var PDO
*/
public $db;
// 此处删除了代码
}