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

82 lines
2.5 KiB
PHP
Raw 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("/market")
*/
class Market extends apiBase {
/**
* 获取商户信息(错误代码15000-15050)
* @route({"POST","/"})
* @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 getMarketInfo($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('syweb_market.*')
->from('syweb_market')
->where('syweb_market.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];
$data = array();
$data["market_key"] = $marketList["market_key"];
$data["market_name"] = $marketList["market_name"];
if( !empty($marketList["head_image"]) ) {
$data["head_image"] = "http://open.tscce.cn".$marketList["head_image"];
}
$result["error"] = '0';
$result["data"] = $data;
$result["msg"] = "获取门店信息成功!";
return $result;
}
/** @inject("ioc_factory") */
private $factory;
/**
* @property({"default":"@db"})
* @var PDO
*/
public $db;
// 此处删除了代码
}