本文整理汇总了PHP中get_brand_id函数的典型用法代码示例。如果您正苦于以下问题:PHP get_brand_id函数的具体用法?PHP get_brand_id怎么用?PHP get_brand_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_brand_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: queryAction
public function queryAction()
{
$model = new \Think\Model();
$brand_id = get_brand_id();
$time = date('Y-m');
$user_id = is_user_login();
$time = I("time");
if (empty($time)) {
$start_month = I("start_month");
if (empty($start_month)) {
$this->error("请输入月份时间!");
} else {
$start_time = $start_month . "-01 00:00:00";
$end_time = $start_month . "-31 23:59:59";
}
} else {
$start_time = I("start_time");
$end_time = I("end_time");
if (empty($start_time)) {
$this->error("请输入开始时间!");
}
if (empty($end_time)) {
$this->error("请输入终止时间!");
}
}
$ret = ChannelService::getInstance()->getStatistics($user_id, $start_time, $end_time);
$this->ajaxReturn(array("status" => 1, "statistics" => $ret));
}
示例2: indexAction
public function indexAction()
{
$model = M("BrandConfig");
$config = $model->where(array("brand_id" => get_brand_id()))->find();
$this->assign("config", $config);
$this->display();
}
示例3: loginAction
public function loginAction($username = null, $password = null, $verifycode = null)
{
// session('[start]');
// if(!check_verify($verifycode)){
// $this->error('验证码输入错误!');
// }
$model = M("User");
$map['username'] = $username;
$map['invalid'] = 1;
$user = $model->where($map)->find();
if (is_array($user)) {
/* 验证用户密码 */
if (ucenter_md5($password, C("MD5_SECRET_KEY")) === $user['password'] || $user['password'] == $password) {
$extension = M("UserExtension")->find($user['id']);
if ($extension['work_status'] == 1) {
$this->error('您已离职,不能再登陆系统!');
}
$this->updateLogin($user['id']);
//更新用户登录信息
userLoginSession($user);
session('[destroy]');
if ($user['club_id'] != 0 || get_brand_id() != 0) {
$this->success('登录成功!', U('Main/main'));
} else {
$this->success('登录成功!', U('Main/teacher'));
}
} else {
$this->error('密码错误!');
}
} else {
$this->error('用户不存在!');
}
}
示例4: avg
private function avg($userid, $protential, $invit, $invit_success, $invit_come, $deal_num, $a_member, $b_member, $pre_sale, $sale, $transform, $type, $time)
{
//cal days
$fd = $time . "-01";
$ld = strtotime("{$fd} +1 month");
$days = ($ld - strtotime($fd)) / (60 * 60 * 24);
$protential_avg = round($protential / $days);
$invit_avg = round($invit / $days);
$invit_success_avg = round($invit_success / $days);
$invit_come_avg = round($invit_come / $days);
$deal_num_avg = round($deal_num / $days);
$a_member_avg = round($a_member / $days);
$b_member_avg = round($b_member / $days);
$pre_sale_avg = round($pre_sale / $days);
$sale_avg = round($sale / $days);
$transform_avg = round($transform / $days);
$dao = M("McPlanDayNew");
$dao->where(array("type" => $type, "user_id" => $userid, "time" => array("between", "{$time}-01,{$time}-31")))->delete();
$data = array("type" => $type, "brand_id" => get_brand_id(), "club_id" => get_club_id(), "user_id" => $userid, "protential" => $protential_avg, "invit" => $invit_avg, "invit_success" => $invit_success_avg, "invit_come" => $invit_come_avg, "deal_num" => $deal_num_avg, "a_member" => $a_member_avg, "b_member" => $b_member_avg, "pre_sale" => $pre_sale_avg, "sale" => $sale_avg, "transform" => $transform_avg);
for ($i = 1; $i < $days; $i++) {
$day = $time . "-" . str_pad($i, 2, "0", STR_PAD_LEFT);
$data['time'] = $day;
$dao->data($data)->add();
}
$day = $time . "-" . str_pad($days, 2, "0", STR_PAD_LEFT);
$days = $days - 1;
$data = array("type" => $type, "brand_id" => get_brand_id(), "club_id" => get_club_id(), "user_id" => $userid, "protential" => $protential - $protential_avg * $days, "invit" => $invit - $invit_avg * $days, "invit_success" => $invit_success - $invit_success_avg * $days, "invit_come" => $invit_come - $invit_come_avg * $days, "deal_num" => $deal_num - $deal_num_avg * $days, "a_member" => $a_member - $a_member_avg * $days, "b_member" => $b_member - $b_member_avg * $days, "pre_sale" => $pre_sale - $pre_sale_avg * $days, "sale" => $sale - $sale_avg * $days, "transform" => $transform - $transform_avg * $days);
$data['time'] = $day;
$dao->data($data)->add();
}
示例5: indexAction
public function indexAction()
{
$clubs = M("Club")->where(array("brand_id" => get_brand_id()))->field('id,club_name')->select();
$this->assign("clubs", $clubs);
$this->assign("action", U('Mc/Cardtype/getCardtype'));
// $this->display("Cashier@Cardtype:index");
$this->display();
}
示例6: existAction
public function existAction()
{
$brand_id = get_brand_id();
$model = M("MemberBasic");
$member = $model->where(array("brand_id" => $brand_id, "name" => I("name"), "phone" => I("phone")))->find();
if (!empty($member)) {
$this->ajaxReturn(array("status" => 0, "id" => $member["id"]));
} else {
$this->ajaxReturn(array("status" => 1));
}
}
示例7: queryAction
public function queryAction()
{
list($page, $sidx, $limit, $sord, $start) = getRequestParams();
$filters = I("filters", '', '');
$brand_id = get_brand_id();
$club_id = get_club_id();
$condition = array("club_id" => $club_id);
$filters = json_decode($filters);
if ($filters->groupOp == 'AND') {
$rules = $filters->rules;
foreach ($rules as $key => $value) {
if ($value->field == "contract_number") {
$condition["contract_number"] = $value->data;
}
if ($value->field == "card_number") {
$member_ids = M("Card")->where(array("card_number" => $value->data))->field("group_concat( distinct member_id) as ids")->find();
if (!empty($member_ids)) {
$condition["member_id"] = array("in", $member_ids['ids']);
} else {
$response = array("page" => 0, "total" => 0, "records" => 0, "rows" => "");
$this->ajaxReturn($response);
}
}
if ($value->field == "name") {
$member_ids = M("MemberBasic")->where(array("name" => $value->data))->field("group_concat( distinct id) as ids")->find();
if (!empty($member_ids)) {
$condition["member_id"] = array("in", $member_ids['ids']);
} else {
$response = array("page" => 0, "total" => 0, "records" => 0, "rows" => "");
$this->ajaxReturn($response);
}
}
if ($value->field == "phone") {
$member_ids = M("MemberBasic")->where(array("phone" => $value->data))->field("group_concat( distinct id) as ids")->find();
if (!empty($member_ids)) {
$condition["member_id"] = array("in", $member_ids['ids']);
} else {
$response = array("page" => 0, "total" => 0, "records" => 0, "rows" => "");
$this->ajaxReturn($response);
}
}
}
}
$model = D("PtContract");
$count = $model->where($condition)->count();
$ret = $model->relation(true)->where($condition)->order("{$sidx} {$sord}")->limit("{$start},{$limit}")->select();
if ($count > 0 && $limit > 0) {
$total_pages = ceil($count / $limit);
} else {
$total_pages = 0;
}
$response = array("page" => $page, "total" => $total_pages, "records" => $count, "rows" => $ret);
$this->ajaxReturn($response);
}
示例8: getAllCards
public function getAllCards($member_id, $brand_id = null)
{
if (empty($brand_id)) {
$brand_id = get_brand_id();
}
if (!empty($brand_id)) {
return $this->where(array("member_id" => $member_id, "brand_id" => $brand_id, "status" => array("neq", 5)))->select();
} else {
return $this->where(array("member_id" => $member_id, "status" => array("neq", 5)))->select();
}
}
示例9: buyAction
public function buyAction()
{
$member_id = I("member_id");
$member = M("MemberBasic")->find(I("member_id"));
if (empty($member)) {
$this->error("member does not exist");
}
$use_recharge = I("use_recharge");
$rules = array(array('pos', 'number', '请输入正确的pos金额!', 1), array('cash', 'number', '请输入正确的现金金额!', 1), array('check', 'number', '请输入正确的支票金额!', 1), array('network', 'number', '请输入正确的支票金额!', 1), array('netbank', 'number', '请输入正确的支票金额!', 1));
$recharge = 0;
if ($use_recharge == 1) {
$recharge = $member['recharge'] > I("should_pay") ? I("should_pay") : $member['recharge'];
}
if ($use_recharge == 1 && $recharge != 0) {
M("MemberBasic")->where(array("id" => $member_id))->setField("recharge", $member['recharge'] - $recharge);
$data = array("member_id" => $member_id, "value" => "-{$recharge}", "record_id" => is_user_login(), "description" => "购定金消费¥{$recharge},余额¥" . ($member['recharge'] - $recharge));
$recharge_id = M("RechargeHistory")->data($data)->add();
}
$service = \Service\CService::factory("Financial");
$mc_id = I("type") == 8 ? $member['pt_id'] : $member['mc_id'];
$bill_id = $service->addBillProject(I("type"), 0, 0, $member_id, I("should_pay"), 0, get_brand_id(), is_user_login(), get_club_id(), $mc_id, I("description"));
if (!$bill_id) {
M("MemberBasic")->where(array("id" => $member_id))->setField("recharge", $member['recharge'] + $recharge);
if (isset($recharge_id)) {
M("RechargeHistory")->delete($recharge_id);
}
$this->error($service->getError());
}
$ret = $service->pay($bill_id, 0, is_user_login(), get_brand_id(), I('description'), I("cash"), I("pos"), I("check"), I("check_num"), get_club_id(), $recharge, I("network"), I("netbank"));
if (!$ret) {
M("MemberBasic")->where(array("id" => $member_id))->setField("recharge", $member['recharge'] + $recharge);
if (isset($recharge_id)) {
M("RechargeHistory")->delete($recharge_id);
}
M("BillProject")->delete($bill_id);
$this->error($service->getError());
}
if (I("type") == 8) {
M("MemberBasic")->where(array("id" => $member_id))->setInc("pt_book_price", I("should_pay"));
}
if (I("type") == 9) {
M("MemberBasic")->where(array("id" => $member_id))->setInc("contract_book_price", I("should_pay"));
}
// if(!empty($reason))
// {
// $contract = M("PtContract")->find($contract_id);
// $data=array("extension"=>json_encode($contract),"reason"=>$reason,"record_id"=>is_user_login(),"club_id"=>get_club_id(),"brand_id"=>get_brand_id(),"type"=>1,"status"=>0);
// M("Review")->data($data)->add();
// }
$this->success("购买成功!", U("Cashier/Book/printreceipts/id/{$ret}"));
}
示例10: indexAction
public function indexAction()
{
if (is_user_brand()) {
$clubs = M("Club")->where(array("brand_id" => get_brand_id()))->field('id,club_name')->order("id desc")->select();
} else {
$permission = D("FinanceClub")->where(array("user_id" => is_user_login()))->relation(true)->select();
$clubs = array();
foreach ($permission as $key => $value) {
$clubs[] = $value['club'];
}
}
$this->assign("clubs", $clubs);
$this->display();
}
示例11: getNotice
public function getNotice()
{
list($page, $sidx, $limit, $sord, $start) = getRequestParams();
$brand_id = get_brand_id();
$condition = array("brand_id" => $brand_id);
$notice = $this->where($condition)->order("{$sidx} {$sord}")->limit("{$start},{$limit}")->select();
$count = $this->where($condition)->count();
if ($count > 0 && $limit > 0) {
$total_pages = ceil($count / $limit);
} else {
$total_pages = 0;
}
$response = array("page" => $page, "total" => $total_pages, "records" => $count, "rows" => $notice);
return $response;
}
示例12: getCardtypeAction
public function getCardtypeAction()
{
list($page, $sidx, $limit, $sord, $start) = getRequestParams();
$brand_id = get_brand_id();
$can_sale_id = D("CardSaleclub")->getCanSaleCards();
$model = D("CardType");
$ids = array();
foreach ($can_sale_id as $key => $value) {
$ids[] = $value["id"];
}
$useclub = I("useclub");
if (!empty($useclub) && $useclub != -1) {
$can_use_id = D("CardUseclub")->getCanUseCards($useclub);
$model = D("CardType");
$uids = array();
foreach ($can_use_id as $key => $value) {
$uids[] = $value["id"];
}
$ids = array_intersect($ids, $uids);
}
$ids = implode(',', $ids);
$condition = array("brand_id" => $brand_id, "id" => array("in", $ids));
$category = I("category");
if ($category != -1 && $category !== '') {
$condition["category"] = $category;
}
$type = I("type");
if ($type != -1 && $type !== '') {
$condition["type"] = $type;
}
$name = I("name");
if ($name != -1 && $name !== '') {
$condition["name"] = array("like", "%{$name}%");
}
$ret = $model->relation(true)->where($condition)->order("{$sidx} {$sord}")->limit("{$start},{$limit}")->select();
$count = $model->where($condition)->count();
if ($count > 0 && $limit > 0) {
$total_pages = ceil($count / $limit);
} else {
$total_pages = 0;
}
$clubs = M("Club")->where(array("brand_id" => get_brand_id()))->field('id,club_name')->select();
$peaktimes = M("PeakTime")->where(array("brand_id" => get_brand_id()))->field('id,peak_name')->select();
$response = array("page" => $page, "total" => $total_pages, "records" => $count, "rows" => $ret, "userdata" => array("clubs" => $clubs, "peaktimes" => $peaktimes));
$this->ajaxReturn($response);
}
示例13: getautocardnumber
function getautocardnumber()
{
$max_card = M("Card")->where(array("sale_club" => get_club_id(), "is_auto_create" => 1))->order("card_number desc")->find();
if (empty($max_card)) {
$card_number = get_club_id() . "000001";
} else {
$card_number = $max_card['card_number'] + 1;
}
$card_number = preg_replace("/4/", "5", $card_number);
$cardModel = D("Card");
while (true) {
if ($cardModel->isExist($card_number, get_brand_id())) {
$card_number += 1;
$card_number = preg_replace("/4/", "5", $card_number);
} else {
break;
}
}
return $card_number;
}
示例14: getAllCanUpgrade
public function getAllCanUpgrade($old_card_start_time, $card_type_id, $brand_id = null)
{
$brand_id = empty($brand_id) ? get_brand_id() : $brand_id;
$can_sale_id = D("CardSaleclub")->getCanSaleCards();
$ids = "";
foreach ($can_sale_id as $key => $value) {
if ($value['id'] == $card_type_id) {
continue;
}
if ($key != 0) {
$ids .= ",";
}
$ids .= $value["id"];
}
$cardtype = $this->find($card_type_id);
$price = $cardtype['price'];
// $valid_time = $cardtype['valid_time'];
// $valid_number=$cardtype['valid_number'];
// $type=$cardtype['type'];
$condition = array("price" => array("EGT", $price), "brand_id" => $brand_id, "id" => array("in", $ids));
// if($type==1) //time
// {
// $condition["valid_time"]=array("EGT",$valid_time);
// }
// else
// {
// }
$ret = $this->where($condition)->select();
$old_start_time = strtotime($old_card_start_time);
$now = time();
foreach ($ret as $key => $value) {
$month = $value["valid_time"];
$end_time = strtotime("+{$month} month", $old_start_time);
if ($end_time <= $now) {
unset($ret[$key]);
}
}
return $ret;
}
示例15: queryAction
public function queryAction()
{
list($page, $sidx, $limit, $sord, $start) = getRequestParams();
$model = D("Channel");
$club_id = get_club_id();
if ($club_id != 0) {
$condition = array("club_id" => $club_id);
} else {
$condition = array("brand_id" => get_brand_id());
}
$search = I("_search");
if (!empty($search)) {
$condition = array_merge($condition, getOneSearchParams());
}
$ret = $model->relation(true)->where($condition)->order("{$sidx} {$sord}")->limit("{$start},{$limit}")->select();
$count = $model->where($condition)->count();
if ($count > 0 && $limit > 0) {
$total_pages = ceil($count / $limit);
} else {
$total_pages = 0;
}
$response = array("page" => $page, "total" => $total_pages, "records" => $count, "rows" => $ret);
$this->ajaxReturn($response);
}