yii結合charjs統計上一年與當前年資料

2021-09-29 07:18:58 字數 3124 閱讀 3564

理論上是1年有12個月,但實際上卻是去年12個月已經過了,是完整的12個月,今年的12個月還沒過,不完整,所以需要補齊

public static function getyearorderchardata() 

// 已支付訂單

$lastyearpaycounts = ; // 前一年月支付訂單總量

$lastyearpayamounts = ; // 前一年月支付訂單總額

$currentyearpaycounts = ; // 當前年月支付訂單總量

$currentyearpayamounts = ; // 當前年月支付訂單額

$allpayorderdataarr = ;

foreach($allpayorderdata as $paykey => $payval)

foreach($months as $key => $val) else

if(array_key_exists($lastyearmonth, $allpayorderdataarr)) else

// 當前年

$currentyearmonth = $currentyear . '-' . $themonth;

if(array_key_exists($currentyearmonth, $allorderdataarr)) else

if(array_key_exists($currentyearmonth, $allpayorderdataarr)) else

}$data = [

'yearcounttitle' => $yearcounttitle,

'yearamounttitle' => $yearamounttitle,

'yearpaycounttitle' => $yearpaycounttitle,

'yearpayamounttitle' => $yearpayamounttitle,

'lastyear' => $lastyear,

'currentyear' => $currentyear,

'labels' => $labels,

'lastyearcounts' => $lastyearcounts,

'lastyearamounts' => $lastyearamounts,

'currentyearcounts' => $currentyearcounts,

'currentyearamounts' => $currentyearamounts,

'lastyearpaycounts' => $lastyearpaycounts,

'lastyearpayamounts' => $lastyearpayamounts,

'currentyearpaycounts' => $currentyearpaycounts,

'currentyearpayamounts' => $currentyearpayamounts,

];return $data;

}

js

// 訂單總量對比

var yearordercountchartcanvas = $('#yearordercountchart').get(0).getcontext('2d')

var yearordercountchartdata = ,]}

var yearordercountchartoptions =

}],yaxes: [}]}

}var yearordercountchart = new chart(yearordercountchartcanvas, );

// 支付訂單總量對比

var yearorderpaycountchartcanvas = $('#yearorderpaycountchart').get(0).getcontext('2d')

var yearorderpaycountchartdata = ,]}

var yearorderpaycountchartoptions =

}],yaxes: [}]}

}var yearorderpaycountchart = new chart(yearorderpaycountchartcanvas, );

// 訂單總額對比

var yearorderamountchartcanvas = $('#yearorderamountchart').get(0).getcontext('2d')

var yearorderamountchartdata = ,]}

var yearorderamountchartoptions =

}],yaxes: [}]}

}var yearorderamountchart = new chart(yearorderamountchartcanvas, );

// 支付訂單總額對比

var yearorderpayamountchartcanvas = $('#yearorderpayamountchart').get(0).getcontext('2d')

var yearorderpayamountchartdata = ,]}

var yearorderpayamountchartoptions =

}],yaxes: [}]}

}var yearorderpayamountchart = new chart(yearorderpayamountchartcanvas, );

記住,yii的as一定要在模型利定義公共變數

public $char_time; // 按時間統計

public $total_order; // 所有訂單

public $total_order_amount; // 所有訂單總額

public $total_pay_order; // 支付訂單

public $total_pay_amount; // 支付訂單總額

public $total_order_pay_amount; // 支付總額

yii框架結合charjs實現統計30天資料的方法

理論上30天資料應該都有,但實際上卻不一定是,所以需要補全 public static function getdayorderchardata days 30 所有使用者 allorderdata self find select from unixtime create at,y m d as ...

這一年,我們一起畢業上

還記得08年的那個夏天,得知自己被大學錄取時的欣喜,轉眼間,已經到了2012年的夏天,4年的時光猶如子彈般飛逝,可不可以再讓子彈飛一會兒 我是個中規中矩的孩子,上大學前真是兩耳不聞窗外事,一心唯讀數理化,對於社會和生活上的事真是八竅已通七竅,就這麼湖裡糊塗的來到了大學,大一和大二上學期,還是已高中時...

review一下上一年的積累

自己從一線開發角色轉變,這個轉變沒有過渡,直接懟上去的,從之前每天只擼完自己的任務 沒有p0級 bug 就 ok。到現在,每次需求評審,需求評審,api評審,中間各種拉動會議,開發中處理跟蹤問題,跟蹤所有人員進度,質量把控,白盒 黑盒。再到預發布 灰度,最後保證按時上線,甚至上線後各種突發 bug,...