Initial commit
This commit is contained in:
@@ -0,0 +1,228 @@
|
||||
<?php
|
||||
|
||||
namespace Member\Controller;
|
||||
|
||||
/**
|
||||
* 用户中心类 继承判断是否用户登录
|
||||
* Class IndexController
|
||||
* @package Member\Controller
|
||||
*/
|
||||
class IndexController extends BaseController
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->table = D("Member");
|
||||
}
|
||||
public function index()
|
||||
{
|
||||
$ShopOrder = D("Shop/ShopOrder");
|
||||
//不同状态下的订单统计
|
||||
$this->readyPayt=$ShopOrder->relation(true)->where(array(
|
||||
"member_id"=>session("member.member_id"),
|
||||
"status_code"=>101,
|
||||
))->order("order_id desc")->select();
|
||||
$this->readyPaytCount=count($this->readyPayt);
|
||||
|
||||
$this->readyDelivery=$ShopOrder->relation(true)->where(array(
|
||||
"member_id"=>session("member.member_id"),
|
||||
"status_code"=>102,
|
||||
))->order("order_id desc")->select();
|
||||
$this->readyDeliveryCount=count($this->readyDelivery);
|
||||
|
||||
$this->readyReceipt=$ShopOrder->relation(true)->where(array(
|
||||
"member_id"=>session("member.member_id"),
|
||||
"status_code"=>103,
|
||||
))->order("order_id desc")->select();
|
||||
$this->readyReceiptCount=count($this->readyReceipt);
|
||||
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function company_info(){
|
||||
if(IS_POST){
|
||||
if(!$data = $this->table->create()){
|
||||
$this->error($this->table->getError());
|
||||
}
|
||||
$data['member_id'] = session("member.member_id");
|
||||
$this->table->save($data);
|
||||
$this->success("保存成功");
|
||||
}
|
||||
$where['catid'] = 4;
|
||||
$where['catid'] = 5;
|
||||
$this->data = $this->table->find(session('member.member_id'));
|
||||
$this->pagetitle="公司新闻";
|
||||
$this->navLight="gsxx";//菜单高亮
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function address(){
|
||||
$this->address = D("MemberAddress");
|
||||
if(IS_POST){
|
||||
if(!$data = $this->address->create()){
|
||||
$this->error($this->address->getError());
|
||||
}
|
||||
$this->address->save($data);
|
||||
$this->success("保存成功");
|
||||
}
|
||||
$where["member_id"] = session("member.member_id");
|
||||
$this->data = $this->address->where($where)->order("sh_status desc,sp_status desc")->select();
|
||||
$this->pagetitle="收件地址";
|
||||
$this->navLight="sjdz";//菜单高亮
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
public function getAddressInfo(){
|
||||
|
||||
$address = M("member_address");
|
||||
|
||||
$where["member_id"] = session("member.member_id");
|
||||
$where["id"] = I('id');
|
||||
$data = $address->where($where)->find();
|
||||
if(!$data){
|
||||
$this->error("你没有此地址");
|
||||
}
|
||||
$this->success($data);
|
||||
}
|
||||
|
||||
public function delete(){
|
||||
|
||||
$address = M("member_address");
|
||||
|
||||
$where["member_id"] = session("member.member_id");
|
||||
$where["id"] = I('id');
|
||||
$data = $address->where($where)->delete();
|
||||
$this->success($data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function setDefault(){
|
||||
$shid = I("setsh");
|
||||
$spid = I("setsp");
|
||||
$this->address = D("MemberAddress");
|
||||
$this->address->setDefault($shid,$spid);
|
||||
$this->success();
|
||||
}
|
||||
|
||||
public function setDefaultInvoice(){
|
||||
$id = I("id");
|
||||
$this->invoice = D("MemberInvoice");
|
||||
$this->invoice->setDefault($id);
|
||||
$this->success();
|
||||
}
|
||||
|
||||
public function invoice(){
|
||||
|
||||
$this->invoice = D("MemberInvoice");
|
||||
if(IS_POST){
|
||||
//发果发票类型为普通发票,删除增值税相关字段
|
||||
if(I("type")==0){
|
||||
unset($_POST["registration_address"]);unset($_POST["registration_mobile"]);unset($_POST["opening_bank"]);unset($_POST["bank_account"]);
|
||||
}
|
||||
//
|
||||
if(!$data = $this->invoice->create()){
|
||||
$this->error($this->invoice->getError());
|
||||
}
|
||||
$this->invoice->save($data);
|
||||
$this->success("保存成功");
|
||||
}
|
||||
$where["member_id"] = session("member.member_id");
|
||||
$this->data = $this->invoice->where($where)->order("status desc")->select();
|
||||
$this->pagetitle="发票信息";
|
||||
$this->navLight="fpxx";//菜单高亮
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function getInvoiceInfo(){
|
||||
|
||||
$invoice = D("MemberInvoice");
|
||||
|
||||
$where["member_id"] = session("member.member_id");
|
||||
$where["id"] = I('id');
|
||||
$data = $invoice->where($where)->find();
|
||||
if(!$data){
|
||||
$this->error("你没有此发票信息");
|
||||
}
|
||||
$this->success($data);
|
||||
}
|
||||
|
||||
public function deleteInvoice(){
|
||||
|
||||
$invoice = M("member_invoice");
|
||||
|
||||
$where["member_id"] = session("member.member_id");
|
||||
$where["id"] = I('id');
|
||||
$data = $invoice->where($where)->delete();
|
||||
$this->success($data);
|
||||
}
|
||||
|
||||
public function update_pwd(){
|
||||
|
||||
if(IS_POST){
|
||||
$data = $this->table->updatePassword();
|
||||
if(!$data){
|
||||
$this->error($this->table->getError());
|
||||
}
|
||||
$this->success($this->table->getError());
|
||||
}
|
||||
$this->pagetitle="修改密码";
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function safe(){
|
||||
$this->navLight="aqzx";//菜单高亮
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
public function change_mobile(){
|
||||
if(IS_POST){
|
||||
$data = $this->table->checkCode();
|
||||
if(!$data){
|
||||
$this->error($this->table->getError());
|
||||
}
|
||||
$this->success($this->table->getError());
|
||||
}
|
||||
$this->pagetitle="更换手机号码";
|
||||
$this->navLight="aqzx";//菜单高亮
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function change_mobile2(){
|
||||
$update_mobile = session("update_mobile");
|
||||
if($update_mobile != 1){
|
||||
$this->error("错误的方式");
|
||||
}
|
||||
if(IS_POST){
|
||||
$data = $this->table->checkCodeAndSaveMobile();
|
||||
if(!$data){
|
||||
$this->error($this->table->getError());
|
||||
}
|
||||
$this->success($this->table->getError());
|
||||
}
|
||||
$this->pagetitle="更换手机号码";
|
||||
$this->navLight="aqzx";//菜单高亮
|
||||
$this->display();
|
||||
}
|
||||
|
||||
public function change_mobile3(){
|
||||
$this->pagetitle="更换手机号码";
|
||||
$this->navLight="aqzx";//菜单高亮
|
||||
$this->display();
|
||||
}
|
||||
|
||||
|
||||
// 发送短信验证码
|
||||
public function sendMobileCode()
|
||||
{
|
||||
$mobile = session("member.mobile");
|
||||
if(!$this->table->sendCode($mobile)){
|
||||
return $this->error($this->table->getError());
|
||||
}
|
||||
return $this->success("发送成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user