|
- <?php
- /**
- *
- * ============================================================================
- * * 版权所有 蜘蛛出行 * *
- * 网站地址: http://www.zhizhuchuxing.com
- * ----------------------------------------------------------------------------
- * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和
- * 使用;不允许对程序代码以任何形式任何目的的再发布。
- * ============================================================================
- * Author By: 张帅
- * PhpStorm WechatCustomer.php
- * Create By 2016/11/17 17:52 $
- */
-
- namespace Order\Model;
-
-
- use Base\Tool\DbTable;
- use Util\Util\Util;
-
- class WechatCustomer extends DbTable
- {
- public $db = 'CST';
- public $tab = 'wechat_customer';
-
- /**
- * Function Description:添加乘客人
- * Function Name: addCustomerAction
- * @param $customer_name
- * @param $customer_id_card
- * @param $we_user_id
- *
- * @return string
- *
- * @author 张帅
- */
- public function addCustomer($customer_name, $customer_id_card, $we_user_id)
- {
- $data = array(
- 'name' => $customer_name,
- 'id_type' => 150,
- 'id_num' => $customer_id_card,
- 'wechat_user_id' => $we_user_id
- );
- $result = $this->insert($data);
- if ($result) {
- return Util::returnJsSu('插入成功');
- } else {
- return Util::returnJsEr('插入失败');
- }
- }
-
- /**
- * Function Description:修改联系人信息
- * Function Name: uptCustomer
- * @param $customer_name
- * @param $customer_id_card
- * @param $customer_id
- *
- * @return array
- *
- * @author 娄梦宁
- */
- public function uptCustomer($customer_name, $customer_id_card, $customer_id)
- {
- $data = array(
- 'cust_name' => $customer_name,
- 'id_type' => 150,
- 'id_num' => $customer_id_card
- );
- $result = $this->update($data, "id=$customer_id");
- if ($result['flag'] == false) {
- return Util::returnArrEr('更新出错');
- }
- return $result;
- }
-
- /**
- * Function Description:获取乘客人
- * Function Name: getCustomerList
- * @param $we_user_id
- *
- * @return string
- *
- * @author 张帅
- */
- public function getCustomerList($we_user_id)
- {
- $sql = '' . 'SELECT
- id AS customer_id,
- `name` AS customer_name,
- id_num AS customer_id_card
- FROM
- wechat_customer
- WHERE
- cancel_flag = 0
- AND wechat_user_id = ' . $we_user_id . '
- AND id_type = 150';
- $result = $this->fetchAll($sql);
- if ($result !== false) {
- return Util::returnJsSu('', $result);
- } else {
- return Util::returnJsEr('数据库错误');
- }
- }
- }
|