Commit f174124c authored by zw's avatar zw

database

parent 4eddc134
......@@ -34,8 +34,6 @@ class TAgentTotalModel extends Model
Db::commit();
return 1;
} catch (\Exception $e) {
print_r($e);
Db::rollback();
return 0;
}
......@@ -52,12 +50,26 @@ class TAgentTotalModel extends Model
foreach ($params as $k => $v) {
$this->db_->table($this->table)->update($v);
}
// $this->saveAll($params);
Db::commit();
return 1;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
}
print_r($e);
/**
* @param $params
* @return int
*/
public function updateTotal($params,$where)
{
Db::startTrans();
try {
$this->db_->where($where)->update($params);
Db::commit();
return 1;
} catch (\Exception $e) {
Db::rollback();
return 0;
}
......
......@@ -133,6 +133,31 @@ class ResultsSummaryNewTask
}
/**
*同城调门店转业绩
* @param $agent_id
* @param $store_id
* @param $district_id
* @param $start_time
* @param $end_time
* @return bool
*/
public function updateStoreByAgentId($agent_id,$store_id,$district_id,$start_time,$end_time){
$date = floor((strtotime($end_time)-strtotime($start_time))/86400);
if($date > 31) {
return false;
}
$params["district_id"] = $district_id;
$params["store_id"] = $store_id;
$where["agent_id"] = $agent_id;
$where["total_time"] = array("between",array($start_time, $end_time));
$is_ok = $this->tAgentTotalModel->updateTotal($params,$where);
if($is_ok > 0 ){
return true;
}
return false;
}
/**
* @param $agent_id
* @param $store_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment