123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- <?php
- /**
- * Created by PhpStorm.
- * User: kang
- * Date: 2021/3/15
- * Time: 12:25
- */
- namespace JinDouYun\Model\Oem;
- use Mall\Framework\Core\ErrorCode;
- use Mall\Framework\Core\StatusCode;
- use Mall\Framework\Core\ResultWrapper;
- use JinDouYun\Model\MBaseModel;
- use JinDouYun\Dao\Oem\DOem;
- use JinDouYun\Dao\Enterprise\DEnterprise;
- class MOem extends MBaseModel
- {
-
- private $objDOem;
- private $enterpriseId;
- private $userCenterId;
- private $objDEnterprise;
-
- public function __construct($enterpriseId = 0, $userCenterId = 0)
- {
- $this->enterpriseId = $enterpriseId;
- $this->userCenterId = $userCenterId;
- parent::__construct($this->enterpriseId, $this->userCenterId);
-
- $this->objDOem = new DOem('default');
- $this->objDEnterprise = new DEnterprise('default');
-
-
-
- }
-
- /**
- * 获取指定logo贴牌
- */
- public function getOemInfo($oemId)
- {
- $dbResult = $this->objDOem->get($oemId);
- if($dbResult === false){
- return ResultWrapper::fail($this->objDOem->error(), ErrorCode::$dberror);
- } else {
- return ResultWrapper::success( $dbResult );
- }
- }
-
- /**
- * 通过域名获取指定ome数据
- */
- public function getOemInfoByDomain($domain)
- {
- $dbResult = $this->objDOem->get(['domain'=>$domain]);
- if($dbResult === false){
- return ResultWrapper::fail($this->objDOem->error(), ErrorCode::$dberror);
- } else {
- return ResultWrapper::success( $dbResult );
- }
- }
- /**
- * 通过api域名获取指定ome数据
- */
- public function getOemInfoByApiDomain($apiDomain)
- {
- $dbResult = $this->objDOem->get(['apiDomain'=>$apiDomain]);
- if($dbResult === false){
- return ResultWrapper::fail($this->objDOem->error(), ErrorCode::$dberror);
- } else {
- return ResultWrapper::success( $dbResult );
- }
- }
- /**
- * 通过微信开发平台appid获取指定oem数据
- */
- public function getOemInfoByWeiXinOpenAppId($appid)
- {
- $dbResult = $this->objDOem->get(['weixinOpenAppid'=>$appid]);
- if($dbResult === false){
- return ResultWrapper::fail($this->objDOem->error(), ErrorCode::$dberror);
- } else {
- return ResultWrapper::success( $dbResult );
- }
- }
- /**
- * 通过企业id获取指定ome数据
- */
- public function getOemInfoByenterpriseId($enterpriseId)
- {
-
- $this->objDEnterprise->setTable('qianniao_enterprise_1');
- $enterpriseIdDbResult = $this->objDEnterprise->get(['id'=>$enterpriseId]);
- if($enterpriseIdDbResult === false){
- return ResultWrapper::fail($this->objDEnterprise->error(), ErrorCode::$dberror);
- }
- if(empty($enterpriseIdDbResult)){
- return ResultWrapper::fail('查询数据为空', ErrorCode::$dberror);
- }
- if($enterpriseIdDbResult['isoem'] == StatusCode::$delete){
- $dbResult = $this->objDOem->get(['enterpriseId'=> 4]);
- }else{
- $dbResult = $this->objDOem->get(['enterpriseId'=>$enterpriseIdDbResult['oemId']]);
- }
- if($dbResult === false){
- return ResultWrapper::fail($this->objDOem->error(), ErrorCode::$dberror);
- }
- if(empty($dbResult)){
- return ResultWrapper::fail('oem配置项为空', ErrorCode::$dberror);
- }
- return ResultWrapper::success( $dbResult );
- }
- }
|