diff --git a/Application/Admin/Common/extend.php b/Application/Admin/Common/extend.php index e2eb146d7..2bbf3f672 100644 --- a/Application/Admin/Common/extend.php +++ b/Application/Admin/Common/extend.php @@ -1828,69 +1828,170 @@ function getCompanyList() { } -function excelUpStreamTemplate() { - header("Content-type: text/html; charset=gb2312"); - error_reporting(E_ALL); - ini_set('display_errors', TRUE); - ini_set('display_startup_errors', TRUE); - - define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); +//上游cp对账单导出 +function excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money) { + header("Content-type: text/html; charset=gb2312"); + error_reporting(E_ALL); + ini_set('display_errors', TRUE); + ini_set('display_startup_errors', TRUE); + + define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); + + date_default_timezone_set('Europe/London'); + Vendor("PHPExcel.PHPExcel"); + $objReader = \PHPExcel_IOFactory::createReader('Excel5'); + + //设置模板文件 + $objPHPExcel = $objReader->load("Public/Admin/excel/up_stream.xls"); + + + //增加甲方信息 + $objPHPExcel->getActiveSheet()->setCellValue('D2', $data['first_party_info']['partner']); + $objPHPExcel->getActiveSheet()->setCellValue('D3', $data['first_party_info']['link_man']); + $objPHPExcel->getActiveSheet()->setCellValue('D4', $data['first_party_info']['link_phone']); + $objPHPExcel->getActiveSheet()->setCellValue('D5', $data['first_party_info']['address']); + $objPHPExcel->getActiveSheet()->setCellValue('D6', $data['first_party_info']['company_tax_no']); + + //增加乙方信息 + $objPHPExcel->getActiveSheet()->setCellValue('J2', $data['second_party_info']['partner']); + $objPHPExcel->getActiveSheet()->setCellValue('J3', $data['second_party_info']['link_man']); + $objPHPExcel->getActiveSheet()->setCellValue('J4', $data['second_party_info']['link_phone']); + $objPHPExcel->getActiveSheet()->setCellValue('J5', $data['second_party_info']['address']); + $objPHPExcel->getActiveSheet()->setCellValue('J6', $data['second_party_info']['company_tax_no']); + + $objPHPExcel->getActiveSheet()->setCellValue('D7', $data['receive_company']['partner']); //增加支付给对应公司 + $line = 10; + //增加结算记录 + foreach ($data['statement_info'] as $key => $value) { + $objPHPExcel->getActiveSheet()->insertNewRowBefore($line,1)->mergeCells("J$line:K$line"); + $objPHPExcel->getActiveSheet()->setCellValue('C'.$line, $value['statement_begin_time'] . '-' . $value['statement_end_time']); + if ($value['statement_type'] == 1) { + $product_name = $value['type_name']; + $objPHPExcel->getActiveSheet()->setCellValue('F'.$line , '-'); + $objPHPExcel->getActiveSheet()->setCellValue('G'.$line, '-'); + $objPHPExcel->getActiveSheet()->setCellValue('H'.$line, '-'); + $objPHPExcel->getActiveSheet()->setCellValue('I'.$line, '-'); + } else { + $product_name = $value['game_name']; + $objPHPExcel->getActiveSheet()->setCellValue('F'.$line , $value['first_ratio'] . '%'); + $objPHPExcel->getActiveSheet()->setCellValue('G'.$line, $value['second_ratio'] . '%'); + $objPHPExcel->getActiveSheet()->setCellValue('H'.$line, $value['promote_ratio'] . '%'); + $objPHPExcel->getActiveSheet()->setCellValue('I'.$line, $value['fax_ratio']. '%'); + } + $objPHPExcel->getActiveSheet()->setCellValue('D'.$line, $product_name); + $objPHPExcel->getActiveSheet()->setCellValue('E'.$line, $value['pay_amount']); - date_default_timezone_set('Europe/London'); - Vendor("PHPExcel.PHPExcel"); - $objPHPExcel = new \PHPExcel(); - $objReader = \PHPExcel_IOFactory::createReader('Excel5'); + $objPHPExcel->getActiveSheet()->setCellValue('J'.$line, $value['sum_money']); + $line++; + } - //设置模板文件 - $objPHPExcel = $objReader->load("Runtime/upstream.xls"); + //合计 + $objPHPExcel->getActiveSheet()->setCellValue("E" . ($line), $all_sum_money); + $objPHPExcel->getActiveSheet()->setCellValue("J" . ($line), $all_pay_amount); + $objPHPExcel->getActiveSheet()->setCellValue("J" . ($line+1), $big_all_sum_money); //本月分成总金额(人民币大写) - $objPHPExcel->getActiveSheet()->setCellValue('D2', 'chengzhi'); + //收款方 + $objPHPExcel->getActiveSheet()->setCellValue("D" . ($line+2), $data['receive_company']['partner']); + $objPHPExcel->getActiveSheet()->setCellValue("D" . ($line+3), $data['receive_company']['bank_account']); + $objPHPExcel->getActiveSheet()->setCellValue("D" . ($line+4), $data['receive_company']['opening_bank']); - $objPHPExcel->getActiveSheet()->insertNewRowBefore(10,1)->mergeCells('J10:K10')->insertNewRowBefore(10,1)->mergeCells('J10:K10'); + //付款方 + $objPHPExcel->getActiveSheet()->setCellValue("J" . ($line+2), $data['pay_company']['partner']); + $objPHPExcel->getActiveSheet()->setCellValue("J" . ($line+3), $data['pay_company']['bank_account']); + $objPHPExcel->getActiveSheet()->setCellValue("J" . ($line+4), $data['pay_company']['opening_bank']); + ob_end_clean();//清除缓冲区,避免乱码 + header('pragma:public'); + header('Content-type:application/vnd.ms-excel;charset=utf-8;name="上游结算单.xls"'); + header("Content-Disposition:attachment;filename=上游结算单.xls");//attachment新窗口打印inline本窗口打印 + $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); + $objWriter->save('php://output'); + exit; - ob_end_clean();//清除缓冲区,避免乱码 - header('pragma:public'); - header('Content-type:application/vnd.ms-excel;charset=utf-8;name="15415.xls"'); - header("Content-Disposition:attachment;filename=15415.xls");//attachment新窗口打印inline本窗口打印 - $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); - $objWriter->save('php://output'); - exit; +} - } +//下游工会对账单导出 +function excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money) { -function excelDownStreamTemplate() { - header("Content-type: text/html; charset=gb2312"); - error_reporting(E_ALL); - ini_set('display_errors', TRUE); - ini_set('display_startup_errors', TRUE); + header("Content-type: text/html; charset=utf-8"); + error_reporting(E_ALL); + ini_set('display_errors', TRUE); + ini_set('display_startup_errors', TRUE); - define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); + define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '
'); - date_default_timezone_set('Europe/London'); - Vendor("PHPExcel.PHPExcel"); - $objPHPExcel = new \PHPExcel(); - $objReader = \PHPExcel_IOFactory::createReader('Excel5'); + date_default_timezone_set('Europe/London'); + Vendor("PHPExcel.PHPExcel"); + $objPHPExcel = new \PHPExcel(); + $objReader = \PHPExcel_IOFactory::createReader('Excel5'); - //设置模板文件 - $objPHPExcel = $objReader->load("upstream.xls"); + //设置模板文件 + $objPHPExcel = $objReader->load("Public/Admin/excel/down_stream.xls"); + $statement_begin_time = set_show_time($data['statement_begin_time']);//对账开始时间 + $statement_end_time = set_show_time($data['statement_end_time']);//对账截止时间 + $objPHPExcel->getActiveSheet()->setCellValue('A1', "《 {$data['company_name']} 》结算单 + ({$statement_begin_time}-{$statement_end_time}"); - $objPHPExcel->getActiveSheet()->setCellValue('D2', 'chengzhi'); + if ($data['second_party_info']['settlement_type'] == '补点订单') { + $objPHPExcel->getActiveSheet()->setCellValue('D2' , '补点比例'); + } - $objPHPExcel->getActiveSheet()->insertNewRowBefore(10,1); + $line = 3; + foreach ($data['statement_info'] as $key => $value) { + $objPHPExcel->getActiveSheet()->insertNewRowBefore($line,1); + $objPHPExcel->getActiveSheet()->removeConditionalStyles(); - ob_end_clean();//清除缓冲区,避免乱码 - header('pragma:public'); - header('Content-type:application/vnd.ms-excel;charset=utf-8;name="15415.xls"'); - header("Content-Disposition:attachment;filename=15415.xls");//attachment新窗口打印inline本窗口打印 - $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); - $objWriter->save('php://output'); - exit; + $objPHPExcel->getActiveSheet()->setCellValue('A'.$line, $value['statement_begin_time'] . '-' . $value['statement_end_time']); + if ($value['statement_type'] == 1) { + $product_name = $value['type_name']; + $objPHPExcel->getActiveSheet()->setCellValue('D'.$line, '-'); + $objPHPExcel->getActiveSheet()->setCellValue('E'.$line, '-'); + } else { + $product_name = $value['game_name']; + $objPHPExcel->getActiveSheet()->setCellValue('D'.$line, $value['second_ratio'] . '%'); + $objPHPExcel->getActiveSheet()->setCellValue('E'.$line, $value['fax_ratio'] . '%'); + } + $objPHPExcel->getActiveSheet()->setCellValue('B'.$line, $product_name); + $objPHPExcel->getActiveSheet()->setCellValue('C'.$line, $value['pay_amount']); + $objPHPExcel->getActiveSheet()->setCellValue('F'.$line, $value['sum_money']); + $line++; + } + + $objPHPExcel->getActiveSheet()->setCellValue('C'.($line), $all_sum_money);//合计-平台总额 + $objPHPExcel->getActiveSheet()->setCellValue('F'.($line), $all_pay_amount);//合计-结算金额 + + + $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+1), $big_all_sum_money);//大写支付结算金额 + //甲方信息 + $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+3), $data['first_party_info']['jfCompany']);//甲方 + $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+4), $data['first_party_info']['jfPerson']);//联系人 + $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+5), $data['first_party_info']['jfTel']);//联系电话 + $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+6), $data['second_party_info']['invoice_item']);//开票项目 + $objPHPExcel->getActiveSheet()->setCellValue('B'.($line+7), $data['second_party_info']['invoice_type']);//发票类型 + + //乙方信息 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+3), $data['second_party_info']['partner']);//乙方 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+4), $data['second_party_info']['link_man']);//联系人 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+5), $data['second_party_info']['link_phone']);//联系电话 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+6), $data['second_party_info']['address']);//邮寄地址 +// $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+8), $value['pay_amount']);//请汇入此账号 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+8), $data['second_party_info']['bank_account_name']);//户名 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+9), $data['second_party_info']['bank_account']);//银行账号 + $objPHPExcel->getActiveSheet()->setCellValue('E'.($line+10), $data['second_party_info']['opening_bank']);//开户行 + + $filename = '下游结算单'; + ob_end_clean();//清除缓冲区,避免乱码 + header('pragma:public'); + header('Content-type:application/vnd.ms-excel;charset=utf-8;name="15415.xls"'); + header("Content-Disposition:attachment;filename=$filename.xls");//attachment新窗口打印inline本窗口打印 + $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5'); + $objWriter->save('php://output'); + exit; - } +} function getWithdrawNumber() { diff --git a/Application/Admin/Common/function.php b/Application/Admin/Common/function.php index 3664cde6a..d34964caf 100644 --- a/Application/Admin/Common/function.php +++ b/Application/Admin/Common/function.php @@ -775,4 +775,78 @@ function camelize($str, $separator = '_', $littleHump = false) function unCamelize($str, $separator = '_') { return strtolower(preg_replace('/([a-z])([A-Z])/', "$1" . $separator . "$2", $str)); -} \ No newline at end of file +} + +function convertAmountToCn($num) { + //判断$num是否存在 + if(!$num) return '零圆'; + //保留小数点后两位 + $num = round($num, 2); + //将浮点转换为整数 + $tem_num = $num * 100; + //判断数字长度 + $tem_num_len = strlen($tem_num); + if($tem_num_len > 14) { + return '数值过大'; + } + + //大写数字 + $dint = array('零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'); + //大写金额单位 + $danwei = array('仟', '佰', '拾', '亿', '仟', '佰', '拾', '万', '仟', '佰', '拾', '圆'); + $danwei1 = array('角', '分'); + + //空的变量用来保存转换字符串 + $daxie = ''; + + //分割数字,区分圆角分 + list($left_num, $right_num) = explode('.', $num); + + //计算单位长度 + $danwei_len = count($danwei); + //计算分割后的字符串长度 + $left_num_len = strlen($left_num); + $right_num_len = strlen($right_num); + + //循环计算亿万元等 + for($i = 0; $i < $left_num_len; $i++) { + //循环单个文字 + $key_ = substr($left_num, $i, 1); + + //判断数字不等于0或数字等于0与金额单位为亿、万、圆,就返回完整单位的字符串 + if($key_ !== '0' || ($key_ == '0' && ($danwei[$danwei_len - $left_num_len + $i] == '亿' || $danwei[$danwei_len - $left_num_len + $i] == '万' || $danwei[$danwei_len - $left_num_len + $i] == '圆'))) { + $daxie = $daxie . $dint[$key_] . $danwei[$danwei_len - $left_num_len + $i]; + } else { + //否则就不含单位 + $daxie = $daxie . $dint[$key_]; + } + } + + //循环计算角分 + for($i = 0; $i < $right_num_len; $i++) { + $key_ = substr($right_num, $i, 1); + if($key_ > 0) { + $daxie = $daxie . $dint[$key_] . $danwei1[$i]; + } + } + + //计算转换后的长度 + $daxie_len = strlen($daxie); + //设置文字切片从0开始,utf-8汉字占3个字符 + $j = 0; + while($daxie_len > 0) { + //每次切片两个汉字 + $str = substr($daxie, $j, 6); + //判断切片后的文字不等于零万、零圆、零亿、零零 + if($str == '零万' || $str == '零圆' || $str == '零亿' || $str == '零零') { + //重新切片 + $left = substr($daxie, 0, $j); + $right = substr($daxie, $j + 3); + $daxie = $left . $right; + } + $j += 3; + $daxie_len -= 3; + } + + return $daxie . '整'; +} diff --git a/Application/Admin/Controller/AjaxController.class.php b/Application/Admin/Controller/AjaxController.class.php index 5d9edbc81..788aeac1b 100644 --- a/Application/Admin/Controller/AjaxController.class.php +++ b/Application/Admin/Controller/AjaxController.class.php @@ -239,4 +239,7 @@ class AjaxController extends ThinkController{ } $this->ajaxReturn(['code'=>1, 'msg'=>'获取成功', 'data'=>$lists]); } + + + } \ No newline at end of file diff --git a/Application/Admin/Controller/PartnerController.class.php b/Application/Admin/Controller/PartnerController.class.php index 9c677d708..e8d1d608d 100644 --- a/Application/Admin/Controller/PartnerController.class.php +++ b/Application/Admin/Controller/PartnerController.class.php @@ -83,6 +83,12 @@ class PartnerController extends ThinkController if (empty($partner)) { $this->error('请输入合作方名称'); } + if (empty(I('link_man'))) { + $this->error('请输入联系人'); + } + if (empty(I('link_phone'))) { + $this->error('请输入联系电话'); + } if (!in_array($status, [0, 1])) { $this->error('参数异常'); } @@ -93,10 +99,14 @@ class PartnerController extends ThinkController if ($res) { $this->error('合作方已存在'); } + if(!preg_match("/^1[358][0-9]{9}$/u",I('link_phone'))) { $this->error('联系电话格式不正确'); } - + $res2 = $model->where(['link_phone' => I('link_phone')])->getField('id'); + if ($res2) { + $this->error('已存在此联系电话'); + } $time = time(); $save['partner'] = $partner; $save['status'] = $status; @@ -140,6 +150,12 @@ class PartnerController extends ThinkController if (empty($partner)) { $this->error('请输入合作方名称'); } + if (empty(I('link_man'))) { + $this->error('请输入联系人'); + } + if (empty(I('link_phone'))) { + $this->error('请输入联系电话'); + } if (!in_array($status, [0, 1]) || $id == 0) { $this->error('参数异常'); } @@ -160,7 +176,14 @@ class PartnerController extends ThinkController if(!preg_match("/^1[358][0-9]{9}$/u",I('link_phone'))) { $this->error('联系电话格式不正确'); } + $res2 = $model->where([ + 'link_phone' => I('link_phone'), + 'id' => ['neq', $id] + ])->getField('id'); + if ($res2) { + $this->error('已存在此联系电话'); + } $time = time(); $save['id'] = $id; $save['partner'] = $partner; diff --git a/Application/Admin/Controller/PromoteController.class.php b/Application/Admin/Controller/PromoteController.class.php index c28d32ea2..6c5f1fa1c 100644 --- a/Application/Admin/Controller/PromoteController.class.php +++ b/Application/Admin/Controller/PromoteController.class.php @@ -221,8 +221,8 @@ class PromoteController extends ThinkController if ($this->accountExist($account)) { $this->error('该账号已存在'); } - $company_belong = $_REQUEST['company_belong']; - $company_relation = $_REQUEST['company_relation']; + $company_belong = $_REQUEST['company_belong'] ?? 0; + $company_relation = $_REQUEST['company_relation'] ?? 0; $data = array( 'account'=>$account, 'password'=>$password, @@ -347,12 +347,12 @@ class PromoteController extends ThinkController if ($promote['company_id'] != $company_id) { $array['company_id'] = I('company_id'); } - if ($promote['company_belong'] != I('company_belong')) { - $array['company_belong'] = I('company_belong'); - } - if ($promote['company_relation'] != I('company_relation')) { - $array['company_relation'] = I('company_relation'); - } +// if ($promote['company_belong'] != I('company_belong')) { +// $array['company_belong'] = I('company_belong'); +// } +// if ($promote['company_relation'] != I('company_relation')) { +// $array['company_relation'] = I('company_relation'); +// } if ($array) { $res = M("promote", "tab_")->where("chain like '%/{$_POST['id']}/%'")->save($array); } @@ -1292,6 +1292,16 @@ class PromoteController extends ThinkController $verify_status = $_REQUEST['verify_status']; $res = M('promote_belong', 'tab_')->where(['id' => ['in', I('ids')]])->save(['verify_status' => $verify_status]); if (!is_null($res)) { + $promote_belongs = M('promote_belong', 'tab_')->where(['id' => ['in', I('ids')]])->select(); + foreach ($promote_belongs as $promote_belong) { + $update = [ + 'company_belong' => $promote_belong['company_belong'], + 'company_relation' => $promote_belong['company_relation'] + ]; + $res = M("promote", "tab_") + ->where("chain like '%/{$promote_belong['promote_id']}/%' or id={$promote_belong['promote_id']} ") + ->save($update); + } $this->success("操作成功", U('belong')); } else { $this->error('操作失败'); diff --git a/Application/Admin/Controller/PublicController.class.php b/Application/Admin/Controller/PublicController.class.php index e4f5cf2d9..86bda178f 100644 --- a/Application/Admin/Controller/PublicController.class.php +++ b/Application/Admin/Controller/PublicController.class.php @@ -69,13 +69,101 @@ class PublicController extends \Think\Controller } } + /** + * 后台用户登录 + * @author 麦当苗儿 + */ + public function cp_login($mobile = null, $verify = null) + { + if (IS_POST) { + /* 检测验证码 TODO: */ + +// $this->checksafecode($mobile, $verify, false); + $promote = M('promote', 'tab_')->where([ + 'mobile_phone' => $mobile, + 'level' => 1, + ])->find(); + + if ($promote) { + /* 记录登录SESSION和COOKIES */ + $cp_auth = array( + 'user_id' => $promote['id'], + 'account' => $promote['account'], + 'mobile_phone' => $promote['mobile_phone'], + 'nickname' => $promote['nickname'], + 'username' => $promote['nickname'] ?: $promote['account'], + ); + $session_name = 'cp_user_auth'; + if (I('auto_login')) { + session(['name' => $session_name, 'expire' => 60*60*24*30], $cp_auth); + session(['name' => $session_name.'_sign', 'expire' => 60*60*24*30], data_auth_sign($cp_auth)); + } else { + session($session_name, $cp_auth); + session($session_name.'_sign', data_auth_sign($cp_auth)); + } + $uid = $promote['id']; + } else { + $partner = M('partner', 'tab_')->where(['link_man' => $mobile,])->find(); + if ($partner) { + /* 记录登录SESSION和COOKIES */ + $cp_auth = array( + 'user_id' => $partner['id'], + 'account' => $partner['link_phone'], + 'mobile_phone' => $partner['link_phone'], + 'nickname' => $partner['link_man'], + 'username' => $partner['link_man'] ?: $partner['account'], + ); + $session_name = 'cp_user_auth'; + if (I('auto_login')) { + session(['name' => $session_name, 'expire' => 60*60*24*30], $cp_auth); + session(['name' => $session_name.'_sign', 'expire' => 60*60*24*30], data_auth_sign($cp_auth)); + } else { + session($session_name, $cp_auth); + session($session_name.'_sign', data_auth_sign($cp_auth)); + } + + $uid = $promote['id']; + } + } + + if (0 < $uid) { //UC登录成功 + /* 登录用户 */ + $this->success('登录成功!', U('VerifyBill/index')); + } else { //登录失败 + $this->error('该账号没有权限登录对账系统'); + } + } else { + if (session('cp_user_auth')) { + $this->redirect('VerifyBill/index'); + } else { + /* 读取数据库中的配置 */ + $config = S('DB_CONFIG_DATA'); + if (!$config) { + $config = D('Config')->lists(); + S('DB_CONFIG_DATA', $config); + } + C($config); //添加配置 + + $this->display(); + } + } + } + + public function cp_logout() + { + session('cp_user_auth', null); + session('cp_user_auth_sign', null); + $this->redirect('cp_login'); + } + /* 退出登录 */ public function logout() { if (is_login()) { D('Member')->logout(); - session('[destroy]'); - session('user_auth_promote_ids'); + session('user_auth', null); + session('user_auth_sign', null); + session('user_auth_promote_ids', null); cookie('think_language', Null); // $this->success('退出成功!', U('login')); $this->ajaxReturn(array('status' => 1, 'msg' => '退出成功!')); @@ -238,4 +326,48 @@ class PublicController extends \Think\Controller cookie('think_language', 'en-us'); $this->ajaxReturn(['status' => 1]); } + + /** + * 发动手机验证码 + */ + public function telsafecode($phone = '', $delay = 10, $flag = true) + { + $result = R('Common/Sms/send_sms_code', array($phone, $delay, false)); + + if ($result['code'] == 200) { + $data['status'] = 1; + $data['data'] = $result['data']; + } else { + $data['status'] = 0; + } + + $data['msg'] = $result['msg']; + + echo json_encode($data); + exit; + } + + /** + * 手机安全码验证 + * @param bool $flag true 用于直接异步请求 false 用于方法调用 + * @param [type] $vcode [description] + */ + public function checksafecode($phone, $vcode, $flag = true) + { + $result = R('Common/Sms/verify_sms_code', array($phone, $vcode, false)); + + if ($result['code'] == 200) { + $data['status'] = 1; + if ($flag) { + echo json_encode($data); + exit; + } + } else { + $data['status'] = 0; + $data['msg'] = $result['msg']; + echo json_encode($data); + exit; + } + } + } diff --git a/Application/Admin/Controller/VerifyBillController.class.php b/Application/Admin/Controller/VerifyBillController.class.php new file mode 100644 index 000000000..f214430b2 --- /dev/null +++ b/Application/Admin/Controller/VerifyBillController.class.php @@ -0,0 +1,106 @@ + + */ +class VerifyBillController extends Controller { + /** + * VerifyBillController constructor. + */ + public function __construct() + { + parent::__construct(); + if (empty(session('cp_user_auth'))) { + redirect('admin.php?s=public/cp_login.html'); + } + } + + + /** + * + */ + public function index(){ + $m_title = '对账单管理'; + $list_data = DM('statement')->order('create_time desc')->select(); + foreach ($list_data as $key => $value) { + $list_data[$key]['statement_type_str'] = $value['statement_type'] ? '工会对账单' : 'cp对账单'; + } + $this->assign('list_data', $list_data); + $this->assign('meta_title', $m_title); + $this->display(); + } + + public function show() + { + $id = I('id'); + $data = DM('statement')->where(['id' => $id])->find(); + $data['first_party_info'] = json_decode($data['first_party_info'], 1);//甲方 + $data['second_party_info'] = json_decode($data['second_party_info'], 1);//乙方 + $data['statement_info'] = json_decode($data['statement_info'], 1);//结算记录 + //收款方 + $data['receive_company'] = $data['pay_type'] ? $data['first_party_info']['partner'] : $data['second_party_info']['partner']; +// dd($data); + $all_sum_money = array_sum(array_column($data['statement_info'], 'sum_money'));//合计平台总额 + $all_pay_amount = array_sum(array_column($data['statement_info'], 'pay_amount'));//合计结算金额 + $big_all_sum_money = convertAmountToCn($all_sum_money);//大写 + $this->assign('big_all_sum_money', $big_all_sum_money); + $this->assign('all_sum_money', $all_sum_money); + $this->assign('all_pay_amount', $all_pay_amount); + $this->assign('data', $data); + $this->assign('from', I('from')); + if ($data['statement_type'] == 1) {//下游 + $template = 'company_show'; + } else { + $template = 'partner_show';//上游 + } + $this->display($template); + } + + public function confirm() + { + $id = I('id'); + $res = DM('statement')->where(['id' => $id])->save(['is_confirm' => 1]); + if ($res) { + $this->success("操作成功", U('index')); + } else { + $this->error('操作失败'); + } + } + + /** + *导出excell + * @param int id + */ + public function export() + { + $id = I('id'); + $data = DM('statement')->where(['id' => $id])->find(); + $data['first_party_info'] = json_decode($data['first_party_info'], 1);//甲方 + $data['second_party_info'] = json_decode($data['second_party_info'], 1);//乙方 + $data['statement_info'] = json_decode($data['statement_info'], 1);//结算记录 + //收款方 +// dd($data); + $all_sum_money = array_sum(array_column($data['statement_info'], 'sum_money'));//合计平台总额 + $all_pay_amount = array_sum(array_column($data['statement_info'], 'pay_amount'));//合计结算金额 + + $big_all_sum_money = convertAmountToCn($all_sum_money);//大写 + $data['receive_company'] = $data['pay_type'] ? $data['first_party_info'] : $data['second_party_info']; + $data['pay_company'] = $data['pay_type'] ? $data['second_party_info'] : $data['first_party_info']; + dd($data['statement_info']); + if ($data['statement_type'] == 1) {//下游 + excelDownStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money); + } else {//上游 + excelUpStreamTemplate($data, $all_sum_money, $all_pay_amount, $big_all_sum_money); + } + + + + } + +} diff --git a/Application/Admin/Model/PromoteModel.class.php b/Application/Admin/Model/PromoteModel.class.php index 2e9a02bd8..79f870885 100644 --- a/Application/Admin/Model/PromoteModel.class.php +++ b/Application/Admin/Model/PromoteModel.class.php @@ -414,6 +414,7 @@ class PromoteModel extends Model{ foreach ($result as $key => $value) { $parseData[$key] = $value; $parseData[$key]['company_belong_str'] = $value['company_belong'] ? '外团' : '内团'; + $parseData[$key]['company_relation_str'] = $value['company_belong'] ? '只维护' : '自主开发及维护'; } return $parseData; } diff --git a/Application/Admin/View/Partner/add.html b/Application/Admin/View/Partner/add.html index d4efaf0cd..3ec975c91 100644 --- a/Application/Admin/View/Partner/add.html +++ b/Application/Admin/View/Partner/add.html @@ -37,14 +37,14 @@ - 联系人: + *联系人: - 联系电话: + *联系电话: diff --git a/Application/Admin/View/Partner/edit.html b/Application/Admin/View/Partner/edit.html index 902c9b0dd..755bf89a7 100644 --- a/Application/Admin/View/Partner/edit.html +++ b/Application/Admin/View/Partner/edit.html @@ -37,14 +37,14 @@ - 联系人: + *联系人: - 联系电话: + *联系电话: diff --git a/Application/Admin/View/Promote/add.html b/Application/Admin/View/Promote/add.html index ccc01973a..dc05f83fe 100644 --- a/Application/Admin/View/Promote/add.html +++ b/Application/Admin/View/Promote/add.html @@ -67,35 +67,35 @@ - - 工会归属: - - - - - - - - - - - 工会关系: - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 真实姓名: diff --git a/Application/Admin/View/Promote/edit.html b/Application/Admin/View/Promote/edit.html index 6abc2b084..38af1c9f4 100644 --- a/Application/Admin/View/Promote/edit.html +++ b/Application/Admin/View/Promote/edit.html @@ -195,7 +195,7 @@ - + + <!– –> @@ -234,11 +234,11 @@ name="company_relation" > 只维护 - + <!– –> - + <!–非会长只能查看–> 工会归属: @@ -250,7 +250,7 @@ disabled="disabled" name="company_belong" class="company_belong"> 外团 - + <!– –> @@ -265,10 +265,10 @@ disabled="disabled" name="company_relation" > 只维护 - + <!– –> - + --> diff --git a/Application/Admin/View/Promote/lists.html b/Application/Admin/View/Promote/lists.html index c36ecc8df..e03f60b9d 100644 --- a/Application/Admin/View/Promote/lists.html +++ b/Application/Admin/View/Promote/lists.html @@ -185,6 +185,7 @@ 渠道类型 所属会长 工会归属 + 工会关系 商务专员 状态 身份状态 @@ -233,6 +234,7 @@ {$data['company_belong_str']} + {$data['company_relation_str']} {:get_business_affairs_account($data['ba_id'])} diff --git a/Application/Admin/View/Public/cp_base.html b/Application/Admin/View/Public/cp_base.html new file mode 100644 index 000000000..c8fc9fe41 --- /dev/null +++ b/Application/Admin/View/Public/cp_base.html @@ -0,0 +1,387 @@ + + + + + {$meta_title}-{:C('WEB_SITE_TITLE')} + + + + + + + + + + + + + + + + + + +
+ + + + + + + + + +
+ +
+ {:session('cp_user_auth.username')} + + 消息 + {:get_msg()} + +
+
+
+ + + +
这是内容
+ + + + + + + + + +
+
这是内容
+
+ + + + + + + + + + + +
+
+ + + + + + + + diff --git a/Application/Admin/View/Public/cp_login.html b/Application/Admin/View/Public/cp_login.html new file mode 100644 index 000000000..18040110c --- /dev/null +++ b/Application/Admin/View/Public/cp_login.html @@ -0,0 +1,206 @@ + + + + + + + {:C('WEB_SITE_TITLE')} + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + +
+ 欢迎登录后台管理界面平台 + +
+ +
+ + + +
+
+
+

手机号码快捷登录User Login

+
    +
  • + + +
  • +
  • + + +
    获取验证码
    +
  • +
  • +
  • 下次自动登录
  • +
+
+
+ +
+ +
+ + + +
这是内容
+ + + + + + + + diff --git a/Application/Admin/View/Public/login.html b/Application/Admin/View/Public/login.html index 00d8215cd..c9d7d35b0 100644 --- a/Application/Admin/View/Public/login.html +++ b/Application/Admin/View/Public/login.html @@ -113,7 +113,8 @@ data: $(".inputlogin").serialize(), success: function(data) { if(data.status!=1){ - updateAlert(data.info,'tip_error'); + var msg = data.info ? data.info : data.msg; + updateAlert(msg,'tip_error'); setTimeout(function(){ $('#tip').find('.tipclose').click(); $('.reloadverify').click(); diff --git a/Application/Admin/View/Tool/company_info.html b/Application/Admin/View/Tool/company_info.html index 3027beaf3..c2469c7ef 100644 --- a/Application/Admin/View/Tool/company_info.html +++ b/Application/Admin/View/Tool/company_info.html @@ -26,14 +26,14 @@ 公司名称 - + 联系人 - + diff --git a/Application/Admin/View/VerifyBill/company_show.html b/Application/Admin/View/VerifyBill/company_show.html new file mode 100644 index 000000000..ad04083e1 --- /dev/null +++ b/Application/Admin/View/VerifyBill/company_show.html @@ -0,0 +1,226 @@ + + + + + + + + + + + + + + + +
+
+
+
+
乙方:{$data['second_party_info']['partner']}
+
提现单号:{$data['ext_field']}
+
订单类型:{$data['second_party_info']['settlement_type']}
+
联系人:{$data['second_party_info']['link_man']}
+
联系电话:{$data['second_party_info']['link_phone']}
+ +
+
+
+
+
户名:{$data['second_party_info']['bank_account_name']}
+
银行账号:{$data['second_party_info']['bank_account']}
+
开户行:{$data['second_party_info']['opening_bank']}
+
邮寄地址:{$data['second_party_info']['address']}
+
开票项目:{$data['second_party_info']['invoice_item']}
+
发票类型:{$data['second_party_info']['invoice_type']}
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
结算时间产品平台总额补点比例分成比例税费费率结算金额(元)
aOh! 暂时还没有内容!
-{$item.type_name}---{$item.sum_money}
{$item.statement_begin_time}-{$item.statement_end_time}{$item.game_name}{$item.pay_amount}{$item.second_ratio}%{$item.fax_ratio}%{$item.sum_money}
总计-{$all_pay_amount}0--{$all_sum_money}0
本月分成总金额(人民币大写):----{$big_all_sum_money}
+ +
+
+
+
甲方:{$data['first_party_info']['jfCompany']}
+
联系人:{$data['first_party_info']['jfPerson']}
+
联系电话:{$data['first_party_info']['jfTel']}
+
+
+
+ +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + \ No newline at end of file diff --git a/Application/Admin/View/VerifyBill/index.html b/Application/Admin/View/VerifyBill/index.html new file mode 100644 index 000000000..7d5224802 --- /dev/null +++ b/Application/Admin/View/VerifyBill/index.html @@ -0,0 +1,358 @@ + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
对账单类型生成时间对账单日期对账金额确认状态操作
aOh! 暂时还没有内容!
{$data.statement_type_str}{:set_show_time($data['create_time'])}{:set_show_time($data['statement_begin_time'])}-{:set_show_time($data['statement_end_time'])}{$data.statement_money} + + 未确认 + + + 确认 + + + 查看 + 导出 +
+
+ +
+
+ + 导出 + + {$_page|default=''} +
+ + + +
+ + + + + + diff --git a/Application/Admin/View/VerifyBill/partner_show.html b/Application/Admin/View/VerifyBill/partner_show.html new file mode 100644 index 000000000..8cde640f0 --- /dev/null +++ b/Application/Admin/View/VerifyBill/partner_show.html @@ -0,0 +1,256 @@ + + + + + + + + + + + + + + + +
+
+
+
+
甲方:{$data['first_party_info']['partner']}
+
联系人:{$data['first_party_info']['link_man']}
+
联系电话:{$data['first_party_info']['link_phone']}
+
邮寄地址:{$data['first_party_info']['address']}
+
公司税号:{$data['first_party_info']['company_tax_no']}
+
+
+
+
+
乙方:{$data['second_party_info']['partner']}
+
联系人:{$data['second_party_info']['link_man']}
+
联系电话:{$data['second_party_info']['link_phone']}
+
邮寄地址:{$data['second_party_info']['address']}
+
公司税号:{$data['second_party_info']['company_tax_no']}
+
+
+
+ 支付给:{$data['receive_company']} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
结算时间产品平台总额甲方分成比例乙方分成比例渠道费率税费费率结算金额(乙)
结算金额=平台总额*(1-渠道费)*分成比例*(1-税费费率)
aOh! 暂时还没有内容!
-{$item.type_name}{$item.pay_amount}----{$item.sum_money}
{$item.statement_begin_time}-{$item.statement_end_time}{$item.game_name}{$item.pay_amount}{$item.first_ratio}%{$item.second_ratio}%{$item.promote_ratio}%{$item.fax_ratio}%{$item.sum_money}
总计-{$all_pay_amount}-----{$all_sum_money}0
本月分成总金额(人民币大写):------{$big_all_sum_money}
+ +
+ +
+
+
收款方名称:{$data['first_party_info']['partner']}
+
银行账号:{$data['first_party_info']['bank_account']}
+
开户行:{$data['first_party_info']['opening_bank']}
+
+
+
+
+
付款方名称:{$data['second_party_info']['partner']}
+
银行账号:{$data['second_party_info']['bank_account']}
+
开户行:{$data['second_party_info']['opening_bank']}
+
+
+ +
+
+
收款方名称:{$data['second_party_info']['partner']}
+
银行账号:{$data['second_party_info']['bank_account']}
+
开户行:{$data['second_party_info']['opening_bank']}
+
+
+
+
+
付款方名称:{$data['first_party_info']['partner']}
+
银行账号:{$data['first_party_info']['bank_account']}
+
开户行:{$data['first_party_info']['opening_bank']}
+
+
+ + +
+ +
+ + +
+ + +
+ + +
+ + +
+ + + + + + + \ No newline at end of file diff --git a/Data/update.sql b/Data/update.sql index 0556fbc7d..c0f90971d 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -946,6 +946,10 @@ CREATE TABLE `tab_promote_belong` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='推广公会归属管理'; +-- 公司信息 2020-1-8 刘伟文 +INSERT INTO `tab_tool` (`name`, `title`, `config`, `template`, `type`, `status`, `create_time`) VALUES ('company_info', '公司信息', NULL, NULL, '1', '1', NULL); + + diff --git a/Public/Admin/excel/down_stream.xls b/Public/Admin/excel/down_stream.xls new file mode 100644 index 000000000..ce63a4cc4 Binary files /dev/null and b/Public/Admin/excel/down_stream.xls differ diff --git a/Public/Admin/excel/up_stream.xls b/Public/Admin/excel/up_stream.xls new file mode 100644 index 000000000..d3a1f36a8 Binary files /dev/null and b/Public/Admin/excel/up_stream.xls differ diff --git a/ThinkPHP/Common/functions.php b/ThinkPHP/Common/functions.php index 39d74168a..c0ec3d771 100644 --- a/ThinkPHP/Common/functions.php +++ b/ThinkPHP/Common/functions.php @@ -602,6 +602,10 @@ function D($name='',$layer='') { return $model; } +function DM($name='', $tablePrefix='tab_',$connection='') { + return M($name, $tablePrefix,$connection); +} + /** * 实例化一个没有模型文件的Model * @param string $name Model名称 支持指定基础模型 例如 MongoModel:User @@ -622,6 +626,7 @@ function M($name='', $tablePrefix='',$connection='') { return $_model[$guid]; } + /** * 解析资源地址并导入类库文件 * 例如 module/controller addon://module/behavior