67 行
3.1 KiB
PHP
可执行文件
67 行
3.1 KiB
PHP
可执行文件
<?php
|
|
|
|
namespace Common\Model;
|
|
|
|
use Think\Model;
|
|
//[1.3.12]
|
|
/**
|
|
* 代理商表 之后的 AgentModel.class.php 删除
|
|
* Class RetailAgentModel
|
|
* @package Common\Model
|
|
*/
|
|
class RetailAgentModel extends BaseModel
|
|
{
|
|
protected $tableName = 'retail_agent';
|
|
const ID = 'id';
|
|
const PARTNER_ID = 'partnerid';
|
|
const BALANCE = 'balance';//decimal(18,3) DEFAULT NULL COMMENT '代理商佣金',
|
|
const NAME = 'name';//varchar(100) DEFAULT NULL COMMENT '代理商名称',
|
|
const PHONE = 'phone';//,//varchar(13) DEFAULT NULL COMMENT '代理商登录账号',
|
|
const ADD_TIME = 'addtime';//varchar(12) DEFAULT NULL COMMENT '添加时间',
|
|
const STATUS = 'status';//,//smallint(1) DEFAULT '1' COMMENT '是否启用 1启用 2禁用',
|
|
const LAST_TIME = 'last_time';//,//varchar(11) DEFAULT NULL COMMENT '最后一次登陆的时间',
|
|
const PASSWORD = 'password';//,//varchar(32) DEFAULT NULL,
|
|
const BEGIN_TIME = 'begin_time';//,//varchar(13) DEFAULT NULL COMMENT '开始时间',
|
|
const END_TIME = 'end_time';//,//varchar(13) DEFAULT NULL COMMENT '结束时间',
|
|
const ADDRESS = 'address';//,//varchar(255) DEFAULT NULL COMMENT '地址',
|
|
const PROVINCE = 'province';//,//varchar(32) DEFAULT NULL COMMENT '省',
|
|
const CITY = 'city';//,//varchar(64) DEFAULT NULL COMMENT '市',
|
|
const AREA = 'area';//,//varchar(64) DEFAULT NULL COMMENT '区或县',
|
|
const DISCOUNT_ID = 'discountid';//int(11) DEFAULT '0' COMMENT '折扣id',
|
|
const MONEY = 'money';//decimal(10,2) DEFAULT '0.00' COMMENT '代理商余额',
|
|
const AGENT_RATE = 'agent_rate';//decimal(10,6) DEFAULT NULL COMMENT '代理商费率',
|
|
const EXPRESS_SEARCH_STATE = 'express_search';//tinyint(1) DEFAULT '2' COMMENT '1开启 2关闭',
|
|
const ALI_RATE = 'ali_rate';//decimal(10,6) DEFAULT NULL COMMENT '支付宝费率',
|
|
const WX_RATE = 'wx_rate';//decimal(10,6) DEFAULT NULL COMMENT '微信费率',
|
|
const SET_SERVER_PAY = 'set_server_pay';//tinyint(1) DEFAULT 0 COMMENT '是否可以配置自己的服务商支付',
|
|
const SERVER_PAY_STATE = 'server_pay_state';//tinyint(1) DEFAULT 0 COMMENT '是否启用自己的服务商支付',
|
|
|
|
/**
|
|
* 判断代理商是否有效
|
|
* @param $id 代理商id
|
|
* @return mixed
|
|
*/
|
|
public function getFindNormalAgent($id)
|
|
{
|
|
$agent = $this->getFind(array($this::ID => $id, $this::STATUS => 1));
|
|
if (!empty($agent)) {
|
|
if ($agent[$this::STATUS] == 1) {
|
|
$time = time();
|
|
//判断代理商是否过期
|
|
if ($agent[$this::BEGIN_TIME] < $time && $agent[$this::END_TIME] > $time) {
|
|
$res['status'] = 1;
|
|
} else {
|
|
$res['status'] = 0;
|
|
$res['msg'] = '代理商未在有效期内';
|
|
}
|
|
} else {
|
|
$res['status'] = 0;
|
|
$res['msg'] = '代理商异常';
|
|
}
|
|
} else {
|
|
$res['status'] = 0;
|
|
$res['msg'] = '代理商不存在';
|
|
}
|
|
return $res;
|
|
}
|
|
} |